home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Media 22
/
PC MEDIA CD22.iso
/
share
/
prog
/
xyz100s
/
xyz100.doc
< prev
Wrap
Text File
|
1995-09-23
|
149KB
|
3,259 lines
╔═════════════════════════════════════════════════════════════════════╗
║ System requirements ║
╚═════════════════════════════════════════════════════════════════════╝
To run XYZ you will need to meet the following requirements:
1. An 80286 or above IBM compatible computer
2. DOS version 3.3 or above
3. A minimum 128k of free dos memory
╔═════════════════════════════════════════════════════════════════════╗
║ Advantages of XYZ ║
╚═════════════════════════════════════════════════════════════════════╝
1. XYZ is very easy to read and write...no programming degree needed!
2. XYZ compiles to a very small code size.
3. XYZ is inexpensive.
4. XYZ makes fast programs.
5. The XYZ math functions have a variable number of digits...from 9
to 53 digits in length!
╔═════════════════════════════════════════════════════════════════════╗
║ Disadvantages of XYZ ║
╚═════════════════════════════════════════════════════════════════════╝
1. XYZ is limited to 111 characters per line in the source file.
2. This version of XYZ is limited to COM files of less than 64k bytes
in size.
3. The shareware version of XYZ is limited to 40 lines of code.
╔═════════════════════════════════════════════════════════════════════╗
║ Theory behind XYZ ║
╚═════════════════════════════════════════════════════════════════════╝
The purpose behind the creation of XYZ was to enable anyone to sit
down and write their own software or create their own utilities
without having to have a degree in programming to do it. I have seen
the cryptic code that even languages as simple as BASIC and FORTRAN
have and I thought..."there must be a better way.".
There is a revolution of technology taking place in the computer
industry today but unfortunately, there isn't a corresponding
revolution taking place in human nature as far as quality is
concerned. I don't know about you but I'm tired of being forced to
decide between the lesser of two evils when it comes to buying
software. I want to help change that. That is why I decided to make
this software compiler available. Now you or I can decide how much
quality goes into our software and what features we want with it and
all we have to do is just spend a little time to write it ourselves.
Please just take a few moments to look at this software and see if
this is what you've been looking for too. If you don't like it,
that's OK, but please, send me a line and let me know what you think
could be done to make it better.
To accomplish my goal of a simple compiler, I designed XYZ with these
goals in mind:
1. Simple to read and simple to write.
2. XYZ uses mostly three letter commands. This is because research
has shown that three letter words are the easiest words for
people to remember. By placing all commands as the first word
of each line, it is also easier to scan for certain words or
catch mistakes in typing.
3. XYZ cannot use weird, hard to remember syntax, symbols or
reserved arguments.
But no matter how simple programming is made, programming will always
require a person to have strong logical thinking abilities. XYZ
cannot teach you how to think better logically, but if you are
already a good logical thinker, it can help you put your logical
thoughts into computer code easier. XYZ wasn't made with the thought
of making programming simpler at the cost of losing power over your
computer environment either. It has to be simple enough for the
casual user as well as powerful enough for the experienced
programmer to use.
╔═════════════════════════════════════════════════════════════════════╗
║ XYZ License Agreement ║
╚═════════════════════════════════════════════════════════════════════╝
XYZ is copyright material owned by Andrew Robinson and is protected
by United States copyright laws and international treaty provisions.
THIS IS A LEGAL AGREEMENT BETWEEN ALL USERS OF ALL VERSIONS OF XYZ:
XYZ is provided as a shareware program. This entitles one person on
one computer to use and evaluate this product for a period of 30
days. Only the shareware version of XYZ is freely distributable.
Should you decide not to register this product, then all source code
and/or executable software/firmware derived from this XYZ software
application product will remain as the legal property of the owner of
the XYZ software application product.
If you decide to become a registered user, then the owner of the XYZ
software application product will grant you a non-exclusive
royalty-free right to publish your source code and executable
software PROVIDED that you:
1. Do not use the XYZ name, logo, or trademark to market your
software application product.
2. Agree to indemnify, hold harmless, and defend the owner of the
XYZ software application product from and against any claims
or lawsuits (including attorney's fees) that arise or result
from the use of distribution of your software application
product.
3. Do not publish any part or whole of the XYZ software application
product as firmware.
4. Agree to publish your name and/or registration number with the
source code to your software application product (if the source
code is published). It is your responsibility to ensure that
your name and/or registration number remain intact with your
software application product during distribution.
5. Agree to use only the registered version of XYZ to derive your
software application product.
Registering the XYZ software application product will entitle one
person on one computer to use this product per registration. You may
not rent or lease the registered XYZ software application product to
anyone. You may not transfer ownership of the registration. You may
make one copy of the registered XYZ software application product
solely for the purpose of backup or archiving.
You may not reverse engineer, decompile, disassemble, or make
derivatives of any version of the XYZ software application product.
╔═════════════════════════════════════════════════════════════════════╗
║ XYZ Limited Warranty ║
╚═════════════════════════════════════════════════════════════════════╝
The unregistered version of the XYZ software application product is
provided "as is", without warranty of any kind.
All warranties (including any implied warranties) for the registered
version of the XYZ software application product are for a period of
ninety (90) days from the date of receipt of registration. XYZ is
warranted to perform substantially in accordance with the accompanied
written or archived material distributed with the XYZ software
application product.
To the maximum extent permitted by the law, the owner of XYZ
disclaims all other expressed or implied warranties including
warranties implying merchanability and fitness for a particular
purpose.
To the maximum extent permitted by the law, in no event shall the
owner of XYZ be liable for any damages whatsoever (including without
limitation, damages for loss of business profits, interruption of
business, loss of business information, or any other pecuniary loss)
arising out of the use of or inability to use this product, even if
the owner of XYZ has been advised of the possibility of such damages.
Some limitations discussed here may not apply to you depending on
your local state or jurisdiction rulings on these matters.
╔═════════════════════════════════════════════════════════════════════╗
║ TABLE OF CONTENTS: ║
╚═════════════════════════════════════════════════════════════════════╝
CHAPTER TITLE: LINE#:
System requirements ...........................................0001
Advantages of XYZ 0008
Disadvantages of XYZ ..........................................0017
Theory behind XYZ 0024
XYZ License Agreement .........................................0069
XYZ Limited Warranty 0116
TABLE OF CONTENTS: ............................................0143
Definition of ARGUMENT TYPES: 0326
NUMERIC argument types ......................................0345
TEXT argument types 0377
RESERVED argument types .....................................0388
Description of program commands: 0471
/// (and adding comments)....................................0482
--- 0542
abs .........................................................0561
acos 0593
acosh .......................................................0593
add 0566
and .........................................................0570
asin 0593
asinh .......................................................0593
atan 0593
atanh .......................................................0593
call 0616
cmp .........................................................0648
convert 0708
cos .........................................................0728
cosh 0728
dat .........................................................0743
dec 0836
div .........................................................0840
draw ellipse 0845
draw line ...................................................0845
draw rotated ellipse 0845
end .........................................................0905
exp 0914
ext .........................................................0919
file 0943
find ........................................................1047
goto 1070
inc .........................................................1075
input 1079
int .........................................................1101
ior 1128
jeq .........................................................1150
jer 1160
jge .........................................................1170
jgt 1180
jle .........................................................1190
jlt 1200
jne .........................................................1210
len 1220
log .........................................................1227
mouse 1232
mul .........................................................1309
neg 1314
plot ........................................................1318
pop 1400
prn .........................................................1338
push 1400
read ........................................................1391
ret 1416
save ........................................................1421
scr 1447
set .........................................................1463
sin 0725
sinh ........................................................0725
slm 1640
snd .........................................................1653
sub 1672
tan .........................................................0733
tanh 0733
tty .........................................................1680
wait 1689
xor .........................................................1697
XYZ COMPILE TIME ERROR MESSAGES: 1723
Reporting bugs or giving advice ...............................1754
Sample programs to compile 1785
Becoming a registered user ....................................1918
APPENDIX: 1947
Table of key codes: .........................................1950
Table of video modes and their default colors: 1993
Table of ASCII codes: .......................................2049
List of some common DOS 21h interrupts: 2096
Auxiliary Input ...........................................2099
Auxiliary Output 2103
Character Input with Buffer ...............................2107
Character Input without buffer 2111
Character Input with Echo .................................2122
Character Input without Echo (unfiltered) 2126
Character Input without Echo ..............................2130
Character Output 2134
Character string, Output ..................................2138
Check Input Status 2142
Create New Program Segment Prefix (PSP) ...................2147
Direct Console I/O 2151
Disk, Get allocation information about ....................2161
Disk, Get current 2171
Disk, Get data on .........................................2175
Disk, Read sector from (ignoring logical structure) 2183
Disk, Reset ...............................................2197
Disk, Select 2200
Disk, Write Sector to (ignoring logical structure) ........2205
Duplicate Handle 2219
Execute Program ...........................................2229
File directory, Create 2239
File directory, Delete ....................................2247
File directory, Find First File in 2255
File directory, Find Next File in .........................2278
File directory, Get current 2295
File directory, Set current ...............................2306
File, Close 2314
File, Commit (forces buffer to be written out) ............2322
File, Create 2330
File, Create Temporary ....................................2346
File, Create new 2362
File, Delete ..............................................2378
File, Extended open, create, or replace 2386
File, Get or Set Attributes of ............................2433
File, Get or Set Date and Time of 2449
File, Lock or unlock region of ............................2471
File, Open 2486
File, Rename ..............................................2509
File, Set Handle Count (sets maximum number of files) 2518
File, Set location of pointer in ..........................2526
File or Device, Read from 2541
File or Device, Write to ..................................2553
Get Data Transfer Area (DTA) Address 2565
Get Date ..................................................2569
Get Extended Country Information 2576
Get Extended Error Information ............................2591
Get Interrupt Vector 2634
Get DOS Version Number ....................................2639
Get Program Segment Prefix (PSP) Address 2644
Get Return Code ...........................................2648
Get Time 2659
Get Verify Flag ...........................................2666
Get address of InDOS Flag 2671
Get or Set Allocation Strategy ............................2675
Get or Set Break Flag 2692
Get or Set Code Page ......................................2699
Get or Set Country Information 2713
IOCTL (Input/Output Control): .............................2765
Get Device Information 2766
Change Sharing Retry Count ..............................2795
Check Input Status 2804
Check Output Status .....................................2819
Check if Block Device is Remote 2831
Check if Block Device is Removable ......................2842
Check if Handle is Remote 2851
Generic I/O Control for Block Devices ...................2863
Generic I/O Control for Character Devices 2885
Get Logical Drive Map ...................................2911
Read Control Data from Block Device Driver 2924
Read Control Data from Character Device Driver ..........2935
Set Device Information 2946
Set Logical Drive Map ...................................2964
Write Control Data to Block Device Driver 2977
Write Control Data to Character Device Driver ...........2988
Memory, Allocate Block 3000
Memory, Release Block .....................................3011
Memory, Resize Block 3019
Multiplex Interrupt .......................................3028
Printer Output 3037
Redirect Handle ...........................................3042
Set Data Transfer Area (DTA) Address 3048
Set Date ..................................................3052
Set Extended Error Information 3060
Set Interrupt Vector ......................................3065
Set Program Segment Prefix (PSP) Address 3070
Set Time ..................................................3074
Set Verify Flag 3083
Terminate Program .........................................3086
Terminate Program with Return Code 3090
Terminate and stay resident (TSR) .........................3094
List of DOS Extended Error Codes 3098
Using the XYZ Critical Error Handler ..........................3178
╔═════════════════════════════════════════════════════════════════════╗
║ Definition of ARGUMENT TYPES: ║
╚═════════════════════════════════════════════════════════════════════╝
First, let's discuss what exactly is an argument. Most XYZ commands
consist of a three letter word followed by a space. The arguments
are the variables that follow each command. For example, if the
command is an add instruction, then add will be followed by two
arguments that will be added together. But every command cannot
deal with the same arguments as every other command can. The data
stored in a numeric argument is not the same as the data stored in a
text argument. The computer can't tell them apart unless you tell it
by defining your arguments. That is why we must define argument
types when programming on computers. All XYZ argument names can use
any letter or symbol in their name except for a space (The space
indicates the end of a name). The maximum length of the name is
thirty characters. Once defined as either a numeric or text
variable, that same name cannot be used again. XYZ has three basic
argument types defined for it: NUMERIC, TEXT, and RESERVED argument
types.
┌─────────────────────────────────────────────────────────────────────┐
│ NUMERIC argument types... │
└─────────────────────────────────────────────────────────────────────┘
store numbers whose number of significant digits is predefined at the
first line of every XYZ text file with a three digit number. This
number may range from 009 digits to 053 digits. Each numeric argument
thereafter will take up the same amount of significant digits. Some
examples of a numeric argument name would be:
NUMBER1
number2
MAGNETOHYDRODYNAMICS
GIV-ME.2(OF_THEM)!
ETC...
Paid$
Every numeric argument name must be entered in the same format.
The format is (in this order only):
1. Give the sign of the number..."-" for negative numbers or nothing
for positive numbers.
2. Type the number (and the decimal place wherever it is needed).
3. Type a small e if you want to enter an exponent in the number.
4. Give the sign of the exponent..."-" for negative numbers or
nothing for positive numbers. The exponent cannot be greater
than 32767 or smaller than -32767.
Some examples of how you could type a number to be entered into a
numeric variable would be:
dat num Paid$=-1.2345e-245
dat num Paid$=135.7e24
dat num Paid$=5
┌─────────────────────────────────────────────────────────────────────┐
│ TEXT argument types... │
└─────────────────────────────────────────────────────────────────────┘
stores text strings and must be predefined by the command "dat txt".
Some examples of a text argument name would be:
NUMBER1
WHAT!?...
number2
1forthe$money$
2fortheshow
┌─────────────────────────────────────────────────────────────────────┐
│ RESERVED argument types... │
└─────────────────────────────────────────────────────────────────────┘
are already predefined by XYZ. Using these argument types for
anything else other then their intended use can result in errors. The
following is a listing of all reserved variables used by XYZ:
The numeric argument: result
The text argument: buffer
The symbols = and *
These special numeric arguments:
angle
blank
char
col
col2
color
color2
dash1
dash2
error
freq
handle
hite
lptn
mode
mouse
row
row2
size
start
start2
usr1
usr2
usr3
wide
xmin
xmax
ymin
ymax
These special words:
videomode
tty
All of the special numeric arguments have been predefined as numeric
arguments for different XYZ commands. The range of these numeric
arguments is from 0 to 65535 except for the word color and color2
which has a range of 0 to 16,777,215. When used as text arguments,
all special arguments will accept only one letter of text.
The two special words listed above (videomode and tty) are commands
to be used with the "set" command.
The numeric variable "result" has a special place in XYZ. It is the
place where all of the math commands store the result of their
calculations. "Result" must always be the first numeric argument
following the command (except for "sub").
For example:
add Male and Female
adds the number of Males to the number of Females and places the
result of this calculation in the reserved numeric argument "result"
for later retrieval by another command like the following example:
add Male and Female
div result by Children
which adds the number of Males to the number of Females and then
divides the resulting number by the number of Children. Notice that
the sub command is the only command in which the first numeric
argument appears second so that proper use of the sub command when
using the reserved variable "result" would be:
sub Children from result
The text argument "buffer" is another case of a special variable in
the XYZ language. It is a predefined text argument that is 300
characters in length. When your XYZ program is first run, this
argument is filled up with the contents of the command line for the
firsts 128 characters and gibberish for the rest of the text
argument.
╔═════════════════════════════════════════════════════════════════════╗
║ Description of program commands: ║
╚═════════════════════════════════════════════════════════════════════╝
Remember...all of the XYZ commands are case sensitive so that if any
commands are typed into a XYZ program other than the way they have
been described below, they won't be recognized as legal commands.
Also each command is three letters followed by one space. The
following pages are a listing of each command used by XYZ along with
the type and number of arguments needed for each command. A short
description is given of the use of each command and finally, each
description is followed by an example of that command if needed.
┌─────────────────────────────────────────────────────────────────────┐
│ /// and adding comments │
└─────────────────────────────────────────────────────────────────────┘
Since XYZ is such a simple language to write, there is plenty of room
leftover for typing comments. Comments can be added right after the
last argument of a command (after the space). Comments can make a big
difference on how readable your code is to someone else because it
can be used to explain the logic you used or to document some
function without the reader having to look it up. It can also be
used to show the routing of jump commands. For example, taking the
small routine from the mouse command example...
set mouse=0
mouse button
jeq LeftButtonPressed
jne LeftButtonNotPressed
--- LeftButtonPressed
mouse cursor=Newcursor
--- LeftButtonNotPressed
end with 0
I can add comments to explain what I'm trying to do...
set mouse=0 will check the status of the left...
mouse button ...when it was last pressed.
jeq LeftButtonPressed
jne LeftButtonNotPressed
--- LeftButtonPressed
mouse cursor=Newcursor will change the cursor.
--- LeftButtonNotPressed
end with 0
Better yet, I can show the results of each jump, making the program
even more readable...
set mouse=0 will check the status of the left...
mouse button ...when it was last pressed.
jeq LeftButtonPressed ──────────────────────────┐
jne LeftButtonNotPressed ─────────────────────┐ │
--- LeftButtonPressed ────────────────────────│─┘
mouse cursor NewCursor will change the cursor. │
--- LeftButtonNotPressed ─────────────────────┘
end with 0
Finally, the characters "/// " are reserved as a comment line. This
can enable me to separate the program into sections like this...
set mouse=0 will check the status of the left...
mouse button ...when it was last pressed.
jeq LeftButtonPressed ──────────────────────────┐
jne LeftButtonNotPressed ─────────────────────┐ │
/// If the left mouse button was pressed: │ │
--- LeftButtonPressed ────────────────────────│─┘
mouse cursor=NewCursor will change the cursor. │
/// Either way we'll end up here anyways... │
--- LeftButtonNotPressed ─────────────────────┘
end with 0
Use your own imagination to come up with even more ways to make your
program even more readable then this one.
┌─────────────────────────────────────────────────────────────────────┐
│ --- LABEL │
└─────────────────────────────────────────────────────────────────────┘
The --- command is where one part of a XYZ program can reference
another part of the same program through the jump or goto commands.
For example:
cmp buffer to Error!
jeq Errors
goto Elsewhere
--- Errors
end 2
If the result of the "cmp buffer to Error!" is equal, then the
program will jump to the location labeled "Errors". From there it
will end the program with an error level of 2. If the result of the
compare is not equal, then the program will goto the location labeled
Elsewhere.
┌─────────────────────────────────────────────────────────────────────┐
│ abs NumericArgument │
└─────────────────────────────────────────────────────────────────────┘
Computes the absolute value of the numeric argument and places the
result in "result".
┌─────────────────────────────────────────────────────────────────────┐
│ add NumericArgument1 and NumericArgument2 │
└─────────────────────────────────────────────────────────────────────┘
Adds the arguments shown and places the result in "result".
┌─────────────────────────────────────────────────────────────────────┐
│ and TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first char>
set size=<Number of chars to And>
set char="Character to And with"
Ands TextArgument with the specified character, starting at character
number "start". This routine will end after "size" number of
characters have been anded.
For example:
set start=1
set size=13
set char=F
and TextArgument
will And whatever text is in TextArgument with the letter F. It will
do this starting with the 1st character until it has anded 13
characters altogether.
┌─────────────────────────────────────────────────────────────────────┐
│ acos NumericArgument │
│ asin NumericArgument │
│ atan NumericArgument │
│ acosh NumericArgument │
│ asinh NumericArgument │
│ atanh NumericArgument │
└─────────────────────────────────────────────────────────────────────┘
Compute the arccosine, arcsine, arctangent, archypcosine, archypsine,
or archyptangent of the numeric argument and places the result in
"result" (in units of radians).
For example:
arc cos SomeNumber
arc hyp cos AnotherNumber
will compute the arccosine of SomeNumber and place the result of that
calculation in "result". Then the archypcosine of AnotherNumber will
be computed and placed in "result".
The range for the arc functions are: x²<=1
except for acosh in which x²>=1
┌─────────────────────────────────────────────────────────────────────┐
│ call LABEL │
│ call TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within TextArgument to find handle>
Calls the subroutine labeled --- LABEL. Starts executing the next
instruction following the --- LABEL instruction until a "ret"
instruction is encountered. Then XYZ starts executing the next
instruction following the original call instruction. Also will call
the subroutine whose address is stored in TextArgument starting at
"start".
For example:
set start=1
set handle=DoSomething
save handle to TextArgument
call DoSomething
call TextArgument
end with 0
--- DoSomething
ret
will call the subroutine DoSomething. DoSomething will then just
return to the statement following the call statement...call
TextArgument. Call TextArgument is the same as call DoSomething which
will just return to the statement following this call statement
"end", which will just end the program.
┌─────────────────────────────────────────────────────────────────────┐
│ cmp NumericArgument1 to NumericArgument2 │
└─────────────────────────────────────────────────────────────────────┘
Compares the first numeric argument to the second.
┌─────────────────────────────────────────────────────────────────────┐
│ cmp ReservedArgument1 to ReservedArgument2 │
└─────────────────────────────────────────────────────────────────────┘
Compares the first reserved argument to the second. The only
exception to this rule is the reserved argument color because of its
wider range of 0 to 16,777,215. All other reserved arguments have
the range of 0 to 65535.
For example:
cmp size to mouse
cmp col to blank
is legal while:
cmp color to angle
is not.
┌─────────────────────────────────────────────────────────────────────┐
│ cmp TextArgument1 to TextArgument2 │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start1=<Position of first character to Cmp in first argument>
set size=<Number of characters to Cmp>
set start2=<Position of first character to Cmp in second argument
CoMPares "size" number of characters in the first TEXT argument
(starting at position "start") to the second TEXT argument (starting
at position "start2"). These reserved arguments must be Set before
using the cmp statement for the first time. Cmp counts each
character it CoMPares until it finds the first mismatch and then
stops and reports its findings of the mismatch as greater than,
lesser than, equal to (or some combination of these). The location
of this mismatch is returned to the reserved argument size.
For example:
set start1=1
set size=3
set start2=2
cmp Textargument1 to TextArgument2
jne Somewhere
will take 3 characters of text in TextArgument1 (starting with the
1st character) and CoMPare it to whatever text is in TextArgument2
(starting with the 2nd character). If the string contained in
TextArgument1 is
HI!
and the string contained in TextArgument2 is
.HI?
then cmp will return a less than and not equal result to XYZ, set
size to 3, and jump to the location --- Somewhere.
┌─────────────────────────────────────────────────────────────────────┐
│ convert NumericArgument to TextArgument │
│ convert ReservedArgument to TextArgument │
│ convert TextArgument to result │
│ convert TextArgument to ReservedArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first character to start at>
The command "convert TextArgument to result" will start the
conversion at "start" number of characters and will stop whenever it
reaches either a space or any invalid character (any character that
is not a number). It will ALWAYS place the result in "result".
For the command "convert NumericArgument to TextArgument" the
characters will be placed in the given TextArgument at the position
"start" and "size" will be set equal to the number of characters
converted (how many significant digits were placed in the
TextArgument).
┌─────────────────────────────────────────────────────────────────────┐
│ cos NumericArgument │
│ sin NumericArgument │
│ tan NumericArgument │
│ cosh NumericArgument │
│ sinh NumericArgument │
│ tanh NumericArgument │
└─────────────────────────────────────────────────────────────────────┘
Computes the cos, sin, tan, cosh, sinh, or tanh of the numeric
argument and places the result in "result". NumericArgument must be
given in radians for the trig functions.
The range for these trigs functions are: x²<∞ (infinity)
except for cosh in which x²<=1
and except for tan in which x cannot equal a multiple of π (pi).
┌─────────────────────────────────────────────────────────────────────┐
│ dat num NumericArgument= │
│ dat txt ## TextArgument= │
│ dat mouse TextArgument │
└─────────────────────────────────────────────────────────────────────┘
The dat command is placed at the beginning of every XYZ program after
the first line (which is reserved for the size of num arguments). The
dat command is where all arguments to be used in the program are
listed (except for reserved arguments). For example, if a text
argument is called that is not listed in a dat command, then an error
will result during compilation. Dat places data into the numeric or
text argument during compilation if the "=" sign is used as a
delimiter. This is useful for reducing file sizes by setting numeric
or text arguments before the program has to run rather then setting
them during run time. If two dat statements use the same text or
numeric argument name, then the second statement will have no effect.
SETTING TEXT ARGUMENTS...
The command, "dat txt ## TextArgument=" is used to define and
initialize text arguments. The ## parameter is used to reserve
memory for each text argument and can range from one to five thousand
or more characters in length. This is how much memory is reserved for
each text argument used. "Dat txt" statements that span more than one
line should be indented with four spaces because XYZ will terminate
the dat txt statement when it encounters ANY character on the next
line (including the TAB character). Each successive line starting
with four blanks will insert the "Enter" key into that text argument
starting at the beginning of that line.
For example:
dat txt 00 SomeText=What \in/ the "world" is
this?
dat txt 10 MoreText=Hi!
will insert the text string:
What \in/ the "world" is
this?
into the text argument SomeText, and the text string:
Hi!
into the text argument MoreText. Notice that the first dat statement
will reserve only enough bytes of memory to be able to store the text
string listed, while the second dat statement will reserve 10 bytes
of memory for the second text argument but initialize the first three
bytes to the word "Hi!".
SETTING NUMERIC ARGUMENTS...
The first line of EVERY XYZ program is a three digit number ranging
from 001 to 011. This number specifies how many words to reserve for
each numeric argument (a word is two bytes of memory or disk space).
This will also determine how many significant digits will be in all
numeric arguments. See the topic "NUMERIC argument types" for
examples on the proper syntax for initializing numeric arguments.
For example:
dat num Volume=1.23e-4
dat num Molecules
will reserve two numeric arguments. The first will be set to 1.23e-4
and the second will contain uninitialized data.
SETTING TEXT ARGUMENTS FOR CURSORS...
For defining mouse cursors there is a special dat command. It is "dat
mouse" and it creates a text argument 34 bytes in length. The syntax
is as follows:
dat mouse TextArgument #### #### ─LOCATION OF x,y HOT SPOT
dat #### #### #### #### #### #### #### #### ─AND MASK
dat #### #### #### #### #### #### #### ####
dat #### #### #### #### #### #### #### #### ─XOR MASK
dat #### #### #### #### #### #### #### ####
where #### represents a string of hex characters (0 through F). If
you do not understand how to convert a string of pixels to a hex
number then don't worry because I have provided some example cursors
that you can use anyways. See the topic "Sample programs to compile"
for examples of how to create a new graphics cursor.
The mouse cursor is HARDWARE defined as a 16 pixel wide by 16 pixel
tall bitmap. The first two groups of hex characters are reserved for
the X and Y coordinates of the hot spot of the cursor and should not
exceed the range of decimal -128 to +128 ( 0081h > #### > FF85h ).
The next group of 16 hex characters are reserved for the "overwrite"
pattern and the last group of 16 hex characters are for the "xor"
pattern of the new cursor.
┌─────────────────────────────────────────────────────────────────────┐
│ dec ReservedArgument │
└─────────────────────────────────────────────────────────────────────┘
Will decrement (subtract one from) the reserved argument shown.
┌─────────────────────────────────────────────────────────────────────┐
│ div NumericArgument1 by NumericArgument2 │
└─────────────────────────────────────────────────────────────────────┘
Divides the first argument shown by the second argument shown and
places the result in "result".
┌─────────────────────────────────────────────────────────────────────┐
│ draw circle │
│ draw rotated circle │
│ draw line │
└─────────────────────────────────────────────────────────────────────┘
For "draw ellipse" and "draw rotated ellipse", call with:
set wide=<Width of circle>
set hite=<Height of circle>
set color=<Color>
set angle=<Angle in degrees>
set mode=<Logical graphic function>
set col=<Column of circle center location>
set row=<Row of circle center location>
Draws an ellipse in the current color with it's center at "col" and
"row". The width of the ellipse will be equal to "wide" and the
height will be equal to "hite". If wide equals hite, then "draw
ellipse" will draw a circle. If the optional "rotate" argument is
used then the ellipse will be rotated by an angle of "angle" degrees
with respect to the x-axis. 0,0 are the coordinates for the topmost
left corner of the video screen with the coordinates increasing in
value as you go down and to the right on the screen. The routine
will draw only partial circles if any of the points fall outside the
current "xmin", "xmax", "ymin", and "ymax" settings.
For "draw line", call with:
set blank=<Number of blank points>
set col=<Beginning column>
set col2=<Ending column>
set color=<Color>
set dash1=<1st number of solid points>
set dash2=<2nd number of solid points>
set mode=<Logical graphic function>
set row=<Beginning row>
set row2=<Ending row>
Draws a line from col1,row1 to the location col2,row2. The line will
be drawn with the current color "color" and will either (xor and or
overwrite) whatever is already on the screen depending on the current
setting of the reserved argument mode (0=Unmodified 1=And 2=Or
3=Xor). Line will draw "dash1" number of pixels followed by "blank"
number of blank pixels followed by "dash2" number of pixels for the
length of the line. This allows line to draw dashed lines, solid
lines, or dash-dot lines.
For example:
Set these arguments to draw the following line (with each "-"
representing one pixel):
--- -- --- -- --- -- --- -- --- -- ---
set dash1=3─┘ ││
set blank=1────┘│
set dash2=2─────┘
a solid line would need to call draw line with this argument:
set blank=0
┌─────────────────────────────────────────────────────────────────────┐
│ end with ERRORLEVEL │
└─────────────────────────────────────────────────────────────────────┘
Ends the XYZ program with a DOS error level equal to ERRORLEVEL
(which can range from 0 to 255)
For example:
end with 3
┌─────────────────────────────────────────────────────────────────────┐
│ exp NumericArgument │
└─────────────────────────────────────────────────────────────────────┘
Computes e raised to the power of the numeric argument and places the
result in "result".
┌─────────────────────────────────────────────────────────────────────┐
│ ext ( TextString ) │
└─────────────────────────────────────────────────────────────────────┘
XYZ will write the following group of four hex characters directly
into the program as literal instructions:
For example:
ext ( BE01 12AC 3C1A 7408 8AD0 B402 CD21 EBF3 CD20 )
This statement will write the next 18 double digit hex characters
into the XYZ file starting at the point where the ext statement
begins. The characters shown above are the hex representation of the
machine code to perform the following commands:
mov si, offset T2+2
T1: lodsb
cmp al, 26
je T2
mov dl, al
mov ah, 02
int 21h
jmp T1
T2: int 20h
┌─────────────────────────────────────────────────────────────────────┐
│ file close TextArgument/handle │
│ file create TextArgument │
│ file delete TextArgument │
│ file move TextArgument/handle │
│ file open TextArgument │
│ file read from TextArgument/handle to TextArgument │
│ file reset TextArgument/handle │
│ file set TextArgument/handle │
│ file write from TextArgument to TextArgument/handle │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set size=<Number of bytes or chars>
set start=<Postion within TextArgument where handle is stored>
All files must be specified by what are called "handles" because this
is the way DOS handles files. This "handle" is simply a two byte
binary number that DOS references for information about that file in
order to perform input or output of that file from the disk.
TextArgument will contain just a text string with the path name of
the file. TextArgument/Handle will contain the handle of the file.
"file open TextArgument" is the only command you can use to obtain a
file handle from DOS.
File will perform the following file Operations...
┌──────┬────────────────────────────────────────────────────────┐
│close │closes the file specified by the handle in TextArgument.│
├──────┼────────────────────────────────────────────────────────┤
│create│creates the file named in TextArgument. The dos file│
│ │attribute will be set to "A" or "archive". │
├──────┼────────────────────────────────────────────────────────┤
│delete│deletes the file named in TextArgument. │
├──────┼────────────────────────────────────────────────────────┤
│move │increases the file pointer by "size" bytes. │
├──────┼────────────────────────────────────────────────────────┤
│open │opens the existing file named in TextArgument. The│
│ │reserved argument "handle" will be set to the dos│
│ │handle for that file. The file pointer will be reset│
│ │for that file. │
├──────┼────────────────────────────────────────────────────────┤
│read │reads "size" number of bytes from handle of file│
│ │specified in TextArgument. The file pointer will be│
│ │incriminated by "size" or by the actual number of bytes│
│ │read. "size" will be set to the actual number of bytes│
│ │read. │
├──────┼────────────────────────────────────────────────────────┤
│reset │resets the file pointer to the beginning of the file│
│ │specified by the handle in TextArgument. │
├──────┼────────────────────────────────────────────────────────┤
│set │sets the file pointer to the end of the file specified│
│ │by the handle in TextArgument. │
├──────┼────────────────────────────────────────────────────────┤
│write │writes "size" number of bytes from handle of file│
│ │specified in TextArgument1 to TextArgument2. The file│
│ │pointer will be incriminated by "size" or by the actual│
│ │number of bytes read. "Size" will be set to the actual│
│ │number of bytes read. │
└──────┴────────────────────────────────────────────────────────┘
If any operation fails, then the reserved argument "error" will be
set to the DOS error code and the error flag will be set for the jer
command to work.
For example (assume the file README.TXT exists in the directory
C:\DOS\UTILITIES\DOS\ and reads "Scooby Dooby Doo" and is therefore
only 16 bytes in size):
dat txt 00 FileName=C:\DOS\UTILITYS\DOC\README.TXT
dat txt 00 NewText= we love you!
dat txt 00 ErrMessage=Couldn't open file!
dat txt 02 MyFile will be the handle for README.TXT
set start=1
file open FileName will open README.TXT...
jer Oops! ...unless we couldn't find it!
convert handle to MyFile
set size=16 get ready to read 16 bytes...
file read MyFile to buffer
set size=12 since NewText is 12 bytes long
file write NewText to MyFile
file reset MyFile
set size=28
file read MyFile to buffer
tty buffer
file close MyFile
end with 0 because everything went O.K.
--- Oops!
tty ErrMessage will print "Couldn't open file!" to screen.
end with 1 because we had an error!
Wow! Okay, what this example does is first open the file whose path
name is in the text argument FileName. If the file doesn't exist,
the program will detect the error and goto the subroutine Oops!
where it will end the program with an error level of 1. If not then
it will read 16 bytes\chars into the reserved text argument buffer
from the file. buffer will now contain the string "Scooby Dooby
Doo". Next, 12 bytes\chars from the text argument NewText will be
written to the file, starting from wherever the last file operation
left the file pointer at. When the file pointer is reset to 0 by
the file reset command and the file is reread into buffer, we see
that buffer will now contain the string "Scooby Dooby Doo we love
you!". Last of all, the file will be closed and the program will
exit with an error code of 0.
┌─────────────────────────────────────────────────────────────────────┐
│ find char in TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<What position to start at>
set char=<Character to search for>
Finds a character in the text argument that matches the character
typed after char=, starting from position "start". Find counts each
character it compares until it finds the first match and then stops
and reports the location of this match in reserved argument "start"
and also reports the number of characters it searched until it found
the match in reserved argument "size".
For example:
set char=Q
set start=22
find char in TextString
will search for the letter Q in the text argument TextString,
starting at the 22nd character in TextString.
┌─────────────────────────────────────────────────────────────────────┐
│ goto LABEL │
│ goto TextArgument │
└─────────────────────────────────────────────────────────────────────┘
Go to the subroutine labeled --- LABEL.
┌─────────────────────────────────────────────────────────────────────┐
│ inc ReservedArgument │
└─────────────────────────────────────────────────────────────────────┘
Will increment (add one to) the reserved argument shown.
┌─────────────────────────────────────────────────────────────────────┐
│ input TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first character to input in buffer>
set size=<Number of characters to receive>
Input waits for a key to be entered into the text argument. Any ASCII
character may be entered in the text string. It also returns a scan
code in the reserved argument scan if the keyboard returns a blank
(00 hex) character. This is useful for getting certain keys (like the
function keys).
For example:
set start=3
set size=24
inp TextArgument
will input a statement that will get 24 characters from the keyboard
and place it starting at the 3rd character location of TextArgument.
┌─────────────────────────────────────────────────────────────────────┐
│ int HexInterruptNumber ax= bx= cx= dx= di= si= bp= es= ds= │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within TextArgument to find handle>
Performs the hex interrupt indicated. Then it sets the registers
according to the hex values set with the arguments shown in the
command above. All hex numbers must be four digits in length. The
number one would be entered as 0001 and the number 65535 would be
entered as FFFF. For setting register values to point to text
arguments, the reserved argument "start" must be set to the position
where to find the handle of a text argument within that TextArgument.
Use caution with this command if the ds or es registers will be
changed upon return of the interrupt.
For example:
set start=1
set handle=TextString
save handle to TextArgument
int 21 ax=3900 dx=TextArgument
will perform interrupt 21h, service ax=3900h (Create Subdirectory).
Upon entry, dx will contain the address to the text argument
TextString (which is always in the current data segment for XYZ).
┌─────────────────────────────────────────────────────────────────────┐
│ ior TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first character to ior>
set size=<Number of characters to ior>
set char=<Character to ior with>
Inclusively ORs the text argument with the specified character,
starting at character number "start1". This routine will end after
size of characters have been iored.
For example:
set start=4
set size=23
set char=R
ior TextArgument
will or the text argument with the letter R starting at the 4th
character and will or 23 characters altogether.
┌─────────────────────────────────────────────────────────────────────┐
│ jeq LABEL │
│ jeq TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within Textargument to find handle>
If the result of the preceding cmp statement was EQUAL, then goto the
subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ jer LABEL │
│ jer TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within TextArgument to find handle>
If the result of the last operation caused an error, then goto the
subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ jge LABEL │
│ jge TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within Textargument to find handle>
If the result of the preceding cmp statement was GREATER than or
EQuaL, then goto the subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ jgt LABEL │
│ jgt TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within Textargument to find handle>
If the result of the preceding cmp statement was GREATER THAN, then
goto the subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ jle LABEL │
│ jle TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within Textargument to find handle>
If the result of the preceding cmp statement was LESS THAN or EQUAL,
then goto the subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ jlt LABEL │
│ jlt TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within Textargument to find handle>
If the result of the preceding cmp statement was LESS THAN, then goto
the subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ jne LABEL │
│ jne TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within Textargument to find handle>
If the result of the preceding cmp statement was NOT EQUAL, then goto
the subroutine labeled --- LABEL in the program.
┌─────────────────────────────────────────────────────────────────────┐
│ len TextArgument │
└─────────────────────────────────────────────────────────────────────┘
Gets the LENgth of the string in the TextArgument and places that
value in the reserved variable size. It starts by counting the first
character in the argument until it reaches the first "Enter"
character.
┌─────────────────────────────────────────────────────────────────────┐
│ log NumericArgument │
└─────────────────────────────────────────────────────────────────────┘
Computes the natural LOGarithm of the numeric argument and places the
result in "result".
┌─────────────────────────────────────────────────────────────────────┐
│ mouse Command │
│ mouse cursor=TextArgument │
└─────────────────────────────────────────────────────────────────────┘
is the command for controlling the mouse. The following text is a
list of the various mouse functions controlled by mouse:
┌──────┬─────────────────────────────────────────────────────────┐
│button│Will return the status of the mouse buttons. There are│
│ │two buttons (left and right) which can be in one of two│
│ │states (pressed or released). The jeq or jne command can│
│ │be used to detect whether or not a button was pressed or│
│ │released after the but command executes. Jeq is the same│
│ │as saying jump if true and jne is the same as saying jump│
│ │if false. But will also return the coordinates of the│
│ │mouse cursor hot spot to the col and row reserved│
│ │arguments (they will remain unchanged if the button being│
│ │checked had not been pressed or released since the last│
│ │call to but). Notice that when rat but is called with... │
│ ├─────────────────────────────────────────────────────────┤
│ │mouse set equal to 0, then the status of the left button│
│ │being pressed will be checked. │
│ ├─────────────────────────────────────────────────────────┤
│ │mouse set equal to 1, then the status of the right│
│ │button being pressed will be checked. │
│ ├─────────────────────────────────────────────────────────┤
│ │mouse set equal to 2, then the simultaneous status of│
│ │both buttons being pressed will be checked. │
│ ├─────────────────────────────────────────────────────────┤
│ │mouse set equal to 3, then the status of the left button│
│ │being released will be checked. │
│ ├─────────────────────────────────────────────────────────┤
│ │mouse set equal to 4, then the status of the right│
│ │button being released will be checked. │
│ ├─────────────────────────────────────────────────────────┤
│ │mouse set equal to 5, then the simultaneous status of│
│ │both buttons being released will be checked. │
├──────┼─────────────────────────────────────────────────────────┤
│cursor│Will change the graphics cursor to the graphics cursor│
│ │stored in TextArgument. The cursor must have been│
│ │created by a dat mouse statement at the beginning of the│
│ │XYZ source file. │
├──────┼─────────────────────────────────────────────────────────┤
│hide │Hides mouse cursor. │
├──────┼─────────────────────────────────────────────────────────┤
│horz │Sets the Min/Max range for the horizontal cursor│
│ │position.Called with the Min range in the col and the Max│
│ │range in the row reserved arguments. │
├──────┼─────────────────────────────────────────────────────────┤
│pen │Turns light pen on if mouse is set equal to 1 and turns│
│ │the light pen off if mouse is set equal to 0 when the pen│
│ │routine is called. │
├──────┼─────────────────────────────────────────────────────────┤
│reset │Turns on the mouse and resets it. │
├──────┼─────────────────────────────────────────────────────────┤
│show │Displays cursor. │
├──────┼─────────────────────────────────────────────────────────┤
│vert │Sets the Min/Max range for the vertical cursor position.│
│ │Called with the Min range in the row and the Max range in│
│ │the col reserved arguments. │
└──────┴─────────────────────────────────────────────────────────┘
For example:
set mouse=0
mouse button
jeq LeftButtonPressed
jne LeftButtonNotPressed
--- LeftButtonPressed
mouse cursor=NewCursor
--- LeftButtonNotPressed
end
will jump to the label "--- LeftButtonPressed" if the right button of
the mouse was pressed, load a new mouse cursor stored in the text
argument NewCursor, then quit the program. Otherwise, XYZ will jump
to the label "--- LeftButtonNotPressed" and quit.
┌─────────────────────────────────────────────────────────────────────┐
│ mul NumericArgument1 by NumericArgument2 │
└─────────────────────────────────────────────────────────────────────┘
Multiplies the first numeric argument or constant argument with the
second and places the result in "result".
┌─────────────────────────────────────────────────────────────────────┐
│ neg NumericArgument │
└─────────────────────────────────────────────────────────────────────┘
NEGates the numeric argument.
┌─────────────────────────────────────────────────────────────────────┐
│ plot │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set color=<Color>
set angle=<Angle in degrees>
set col=<Center of rotation...X position>
set row=<Center of rotation...Y position>
set col2=<Point starting...X position>
set row2=<Point starting...Y position>
Plots the current color "color" to the given Column and Row (in the
reserved arguments row2 and col2. The point will be rotated by an
angle of "angle" degrees with respect to the x-axis of the video
screen. 0,0 are the coordinates for the topmost left corner of the
video screen with the coordinates increasing in value as you go down
and to the right on the screen. The routine will not draw any points
if any of the points fall outside the current "xmin", "xmax",
"ymin", and "ymax" settings.
┌─────────────────────────────────────────────────────────────────────┐
│ prn TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first character to Prn>
set size=<Number of characters to Prn>
set lptn=<LPTn to use>
Prints the contents of the given text argument starting at character
"start" and stopping after "size" characters have been printed.
For example:
set lptn=1
set start=2
set size=21
prn TextArgument
will print all the text stored in TextArgument (starting with the 2nd
character and ending with the 23rd) out to the printer LPT1.
NOTE: LPT numbers start at 0 and go up to 3. Most printers are
connected to LPT0 which is the default parallel or printer port that
comes with most IBM compatible computers (IBM is a trademark of IBM
Corp). The second printer will be connected to LPT1 and so on.
┌─────────────────────────────────────────────────────────────────────┐
│ push TextArgument │
│ pop TextArgument │
│ push ReservedArgument │
│ pop ReservedArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position within TextArgument to make pop or push>
These two instructions are the most dangerous commands that you can
use. Since push will save two characters (ie -- one word, starting
at position "start" within the called text argument or will save the
reserved argument) on the executable file's stack, and since the
stack is also where the next return address for a call function is
stored, you must be sure to pop whatever you push or your program
will crash.
Pop will restore two characters (one word) starting at position
"start" within the called text argument or will restore to the
reserved argument. These characters (or word) will be restored from
whatever is on the executable file's stack.
The exception to this command is for pushing and popping the
reserved arguments "color" and "color2". This is a three character
save and restore and therefore these two reserved arguments can only
be used with each other.
┌─────────────────────────────────────────────────────────────────────┐
│ read │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set col2=<Column>
set row2=<Row>
Reads the color of the pixel at the Column and Row given by the col
and row reserved arguments and places it in the reserved argument
color2.
For example:
set col2=640
set row2=480
set color=12 00 00
read
cmp color to color2
jle Somewhere
will read the color of the pixel at location (640, 480) of the screen
and compare the color returned to the color placed in the reserved
argument "color". If it is less than or equal to that then it will
jump to the label called Somewhere.
┌─────────────────────────────────────────────────────────────────────┐
│ ret │
└─────────────────────────────────────────────────────────────────────┘
RETurns from a subroutine to the CALLing routine. See the topic
"call".
┌─────────────────────────────────────────────────────────────────────┐
│ save Textargument1 to TextArgument2 │
│ save NumericArgument1 to NumericArgument2 │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first character to Sav>
set size=<Number of characters to Sav>
set start2=<Position of first character to Sav in second argument>
Saves the contents of the first text or numeric argument (starting
with character "start" until "size" characters have been saved) by
placing it into the second text or numeric argument (starting at the
position "start2"). For the numeric arguments, "start", "size", and
"start2" have no effect.
For example:
set start=2
set size=13
set start2=3
save ThisString to ThatString
will take 13 characters of text in ThisString (starting with the 2nd
character) and save it to ThatString (starting with the 3rd
character).
┌─────────────────────────────────────────────────────────────────────┐
│ scr to TextArgument │
│ scr from TextArgument │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set wide=<Width>
set hite=<Height>
set col=<Starting Col>
set row=<Starting Row>
Copies the contents of the SCReen to memory or from memory to the
screen. The reserved argument "hite" determines the height and the
reserved argument "wide" determines the width of the area to be
copied from the screen to the memory. The starting point of the
copy routine is col,row.
┌─────────────────────────────────────────────────────────────────────┐
│ set ReservedArgument=Number <or "character"> │
│ set TextArgument=ReservedArgument │
│ set handle=<any argument or label> │
│ set tty cursor │
│ set tty blink │
│ set videomode=<see list> │
└─────────────────────────────────────────────────────────────────────┘
Sets the reserved argument equal to a number, where number equals 0
to 65535 (16,777,215 for the reserved argument color) or sets the
reserved argument equal to a single character. The number may not
exceed the range defined for that reserved argument as defined in the
section RESERVED arguments.
For example:
set angle=33000
set char=D
will set the reserved argument angle equal to 33,000 and places the
letter D in reserved argument char.
---------------------------------------------------------------------
The command "set handle=" is a special case for the set command. When
"set handle=" is used, handle will be set to the address of a label
or argument only. Set handle cannot be set to equal a character or a
number like the other reserved arguments can.
For example:
set handle=TextArgument
set handle=LABEL
---------------------------------------------------------------------
Setting the reserved arguments "color" or "color2" is also a special
case in that you must list three 2-digit hex numbers in a row like
this:
set color=XX YY ZZ
The reason for using hex numbers is because almost all computer
reference books list colors in terms of hex numbers. This way you
won't have to convert from hex to decimal or vice versa, when doing
research on these various modes:
In text modes XX should equal the color
YY should equal the page number
ZZ should equal 00
In 16 color modes XX should equal the color
YY should equal 00
ZZ should equal 00
In 256 color modes XX should equal the color
YY should equal 00
ZZ should equal 00
In SVGA modes XX should equal the red color component
YY should equal the green color component
ZZ should equal the blue color component
---------------------------------------------------------------------
For the "set tty cursor" and "set tty blink", call with:
set color=<Color and attribute of character to print>
set start=<Position of first character to print>
set size=<Number of characters to print>
set col=<Cursor column>
set row=<Cursor row>
set mode=<1 or 0>
To change the cursor position, use the "set tty cursor" option to set
the cursor to the coordinates specified by the reserved arguments
"row" and "col".
To change the character attribute in text modes or change the
character color in graphics modes, use the reserved argument "color"
set to a number from 00-FF (See Appendix)
To change the available attribute from blinking colors to high
intensity colors (in text modes only), use the "set tty blink" option
with "mode" set to 1 for using blinking attributes or to 0 for
high-intensity attributes.
For example:
set col=0
set row=0
set tty cursor
set mode=0
set tty blink
set color=135
set start=1
set size=99
tty ThisString
will place the cursor at the topmost left corner of the screen. Then
it will choose high intensity attributes meaning that the color
number 135 will be high-intensity white on a black background. It
will print text to the screen, starting from the first character in
the text argument ThisString until it finishes printing 99
characters (about two rows).
---------------------------------------------------------------------
For the "set videomode=" command, XYZ currently supports the
following EGA/VGA video modes (Where A equals Mode, B equals Number
of colors, C equals Rows x Columns, and D equals Type of video
displayed):
┌───┬─────┬─────────┬────────┐
│ A│ B│ C│ D│
├───┼─────┼─────────┼────────┤
│ 2│ 16│ 80x25│ Text│
│ 3│ 16│ 80x25│ Text│
├───┼─────┼─────────┼────────┤
│ 13│ 256│ 320x200│Graphics│
├───┼─────┼─────────┼────────┤
│ 10│ 16│ 640x350│Graphics│
├───┼─────┼─────────┼────────┤
│ 12│ 16│ 640x480│Graphics│
└───┴─────┴─────────┴────────┘
and the following Super VGA video modes:
┌───┬─────┬─────────┬────────┐
│108│ 16│ 80x60│ Text│
│109│ 16│ 132x25│ Text│
│10A│ 16│ 132x43│ Text│
│10B│ 16│ 132x50│ Text│
│10C│ 16│ 132x60│ Text│
├───┼─────┼─────────┼────────┤
│101│ 256│ 640x480│Graphics│
│110│ 32K│ 640x480│Graphics│
│111│ 64K│ 640x480│Graphics│
│112│16.8M│ 640x480│Graphics│
├───┼─────┼─────────┼────────┤
│102│ 16│ 800x600│Graphics│
│103│ 256│ 800x600│Graphics│
│113│ 32K│ 800x600│Graphics│
│114│ 64K│ 800x600│Graphics│
│115│16.8M│ 800x600│Graphics│
├───┼─────┼─────────┼────────┤
│105│ 256│ 1024x768│Graphics│
│116│ 32K│ 1024x768│Graphics│
│117│ 64K│ 1024x768│Graphics│
│118│16.8M│ 1024x768│Graphics│
├───┼─────┼─────────┼────────┤
│107│ 256│1280x1024│Graphics│
│119│ 32K│1280x1024│Graphics│
│11A│ 64K│1280x1024│Graphics│
│11B│16.8M│1280x1024│Graphics│
└───┴─────┴─────────┴────────┘
XYZ Super VGA modes are based on the VESA standard and it must be
loaded in either AUTOEXEC.BAT, CONFIG.SYS, or is included in the
video board hardware.
The VGA/EGA graphics modes 2-13 and modes 108-10C have what are
called color palettes. This color palette is filled with as many
colors as that mode will support. Sixteen color modes will have a
sixteen color palette with each color numbered 00 through 0F. 256
color modes will have a 256 color palette with each color numbered
00 through FF. The colors defined by each number are predefined by
the VGA/EGA standard. For all other graphics modes, the colors are
defined by the actual number placed on the screen by the plot
routine. See appendix A for charts on the actual definitions of
colors for the various modes.
As of this writing, there is no support for the mouse graphics
cursor in Super VGA modes because no standard has been adopted yet
by all manufacturers that will allow programmers to have access to
the mouse cursor in Super VGA modes. My options are to write a
non-standard interface for you, wait for manufacturers to come out
with a standard, or provide source code on how to write your own
interface. If you don't mind, please drop me a line and let me know
which option you think would be best.
┌─────────────────────────────────────────────────────────────────────┐
│ slm Mode │
└─────────────────────────────────────────────────────────────────────┘
Sets the Line Mode for text modes (if possible) to 23, 43, or 50
line mode. The screen will be cleared after the slm command has been
used.
For example:
slm 50
will set the current text mode display to 50 lines if I am in
video mode 2 or 3.
┌─────────────────────────────────────────────────────────────────────┐
│ snd │
│ snd off │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set freq=<Freq>
Modulates the pc speaker with the specified frequency in the
reserved argument freq. Once a frequency is set the speaker will
continue to Sound until another snd statement is encountered that
either changes the frequency or turns it off.
For example:
set freq=256
snd
will cause the PC speaker to oscillate at 256 hertz.
┌─────────────────────────────────────────────────────────────────────┐
│ sub NumericArgument2 from NumericArgument1 │
└─────────────────────────────────────────────────────────────────────┘
SUBtracts the arguments shown and places the result in "result".
For example:
sub NumericArgument2 from NumericArgument1
┌─────────────────────────────────────────────────────────────────────┐
│ tty TextArgument │
└─────────────────────────────────────────────────────────────────────┘
Prints the given text argument to the screen. The ASCII codes for the
bell(07), the backspace(08), the linefeed(10), and the carriage
return(13) are translated to the appropriate actions. Line wrap and
scrolling are also performed automatically. In graphics modes, tty
will only print out to the monitor using color codes 1 - 255 (See the
chart in appendix A).
┌─────────────────────────────────────────────────────────────────────┐
│ wait ## │
└─────────────────────────────────────────────────────────────────────┘
Wait will do nothing until ## of DOS ticks have elapsed. One DOS tick
is equal to 55mS and is the same on all IBM compatible computers. If
## equals 18, then wait will do nothing until one second has elapsed.
This is useful for automatic pausing before resuming a task. The
maximum number of DOS ticks is 65535 which is about one hour.
┌─────────────────────────────────────────────────────────────────────┐
│ xor TextArgument with Character │
│ xor TextArgument1 with TextArgument2 │
└─────────────────────────────────────────────────────────────────────┘
CALL WITH:
set start=<Position of first character to Xor>
set size=<Number of characters to Xor>
set char=<Character to Xor with>
XORs the given text argument with the specified character, starting
at character number "start". This routine will end after "size" of
characters have been XORed unless the second argument is another text
argument. Then the first text argument will be XORed with the second
text argument until starting at character number "start" until all
characters have been used up in either the first or second arguments.
For example:
set start=4
set size=23
set char=R
xor TextArgument
will xor the text argument with the letter R starting at the 4th
character and will xor 23 characters altogether.
╔═════════════════════════════════════════════════════════════════════╗
║ XYZ COMPILE TIME ERROR MESSAGES: ║
╚═════════════════════════════════════════════════════════════════════╝
"Error on line number ##"
Shows on which line in the source file that the error occurred.
Line number 0 is the command line.
"...unable to open file!"
Possibly the wrong file name was typed in on the DOS command line.
"...file must start with numeric size!"
All XYZ source files start with a number. See the topic titled
"Sample programs to compile" for an example.
"...incorrect use of XYZ command!"
Usually a reserved argument was misspelled or missing.
"...nonexistent argument was given!"
An argument was expected but there was none. Check syntax for that
command.
"...argument must be numeric!"
"...argument must be text!"
"...nonexistent label was given!"
The label called out for wasn't found.
"...argument types don't match!"
Arguments must both be numeric or text or reserved.
"...file size greater that 64k!"
Maximum size of an XYZ program is 64k.
"...too many characters on the command line!"
Maximum number of characters per line in the source file is 111
characters.
"...argument must be a label!"
"...argument must equal 25, 43, or 50!"
"...nonexistent command was given!"
Usually a command was misspelled or missing.
╔═════════════════════════════════════════════════════════════════════╗
║ Reporting bugs or giving advice ║
╚═════════════════════════════════════════════════════════════════════╝
You do not have to be a registered user to report bugs or give
advice. Any input you give to me will be appreciated, although I
probably won't be able to respond to you personally, depending on
the number of responses I get. The kind of advice I would like to
see would be something like:
How to make the programs more readable
How to explain a command simpler
New commands to make XYZ easier or more convenient
And so on...
Please send your comments to:
XYZ
PO BOX #40943
Tempe, AZ 85274
You can also leave comments on the Internet at xyz@netzone.com
Some examples of some ideas that have already been suggested are:
Add complex number calculation capability
Make dat statements that can do arrays
Enable extended memory to be usable for storing data
If enough people respond, I will implement these suggestions with the
next release of XYZ.
╔═════════════════════════════════════════════════════════════════════╗
║ Sample programs to compile ║
╚═════════════════════════════════════════════════════════════════════╝
Copy these sample programs to a separate file and compile them with
the XYZ compiler. Some programs may need to be edited to fit in less
than 30 lines of source code, IF you are compiling with the shareware
version of XYZ.
To compile these files you will need to type "xyz <name of your
source file> <name.com>". For example, the following sample file may
be compiled by typing "xyz rat.src rat.com" at the command line.
000 This is a sample test file for various mouse cursors
/// The compiled version of this program can be found
/// under the name "rat.com" in this directory.
dat mouse GunSight 0007 0007
dat F39F CFE7 9FF3 BFFB 7FFD 7FFD FFFF FFFF
dat 7FFD 7FFD 7FFD BFFB 9FF3 CFE7 F39F FFFF
dat 0280 0EE0 1EF0 3EF8 7EFC 7EFC FEFE 0000
dat FEFE 7EFC 7EFC 3EF8 1EF0 0EE0 0280 0000
dat mouse crosshair 0007 0007
dat FDFF F8FF F8FF F8FF F8FF 820F 0707 820F
dat F8FF F8FF F8FF F8FF FDFF FFFF FFFF FFFF
dat 0000 0200 0200 0200 0200 0000 78F0 0000
dat 0200 0200 0200 0200 0000 0000 0000 0000
dat mouse downarrow 0007 0007
dat F83F F83F F83F F83F F83F F83F F83F F83F
dat F83F F83F C007 C007 E00F F01F F83F FC7F
dat 0000 0380 0380 0380 0380 0380 0380 0380
dat 0380 0380 0380 1FF0 0FE0 07C0 0380 0100
dat mouse lefthand 0007 0007
dat FFFF FFFF FC01 FC00 0000 0000 0000 F000
dat F000 F000 F000 F800 F801 FFFF FFFF FFFF
dat 0000 0000 03FE 0203 FFC1 8001 FF81 0801
dat 0F81 0801 0F81 0403 07FE 0000 0000 0000
dat mouse hourglass 0007 0007
dat 8003 0001 8003 8003 C007 E00F F01F F01F
dat C007 C007 8003 8003 0001 8003 FFFF FFFF
dat 0000 7FFC 2008 2808 1510 0AA0 0540 0440
dat 0920 1010 2108 2288 7FFC 0000 0000 0000
set videomode=12 ...which is the 640x480x16 color mode
mouse cursor=GunSight
mouse show
int 16 ax=0000 is the BIOS wait for keypress function
mouse hide
mouse cursor=crosshair
mouse show
int 16 ax=0000
mouse hide
mouse cursor=downarrow
mouse show
int 16 ax=0000
mouse hide
mouse cursor=lefthand
mouse show
int 16 ax=0000
mouse hide
mouse cursor=hourglass
mouse show
int 16 ax=0000
mouse hide
end with 1
eof
This next example file demonstrates a few of the functions of XYZ.
Notice how small this file compiles! How many compilers do you know
of that would perform the same functions as this one in only 5885
bytes? Enjoy...
053 This is a demonstration file
/// The compiled version of this file can be found
/// under the name "sample.com" in this directory.
dat txt sample.xyz=sample.xyz
dat txt $tring=The sin of 2 =
dat txt error=File not found!
dat num number=2
/// Demonstrate graphics
set videomode=12 which is the 640x480x16 color mode
set wide=100
set hite=200
set color=0B 00 00 = bright blue
set angle=-45 degrees
set mode=0
set col=320
set row=240
draw rotated ellipse
set blank=3
set dash1=3
set dash2=6
/// This sets row2=row...
push row
pop row2
set col2=639
draw line
int 16 ax=0000 This interrupt will pause until a key is pressed
set videomode=3 which is normal text mode
/// Demonstrate math capability
set color=0A 00 00 = bright green
set start=1
set size=20
tty $tring
sin number
convert result to buffer
tty buffer
/// Demonstrate file command
file open sample.xyz
jer Error!
/// I could have set up a Critical Error Handler instead of "jer"
set size=27
file read from handle to buffer
set col=0
set row=1
set tty cursor
tty buffer
file reset handle
set size=27
file read from handle to buffer
set mode=1
set tty blink to enable a blinking cursor
set col=0
set row=2
set color=8A 00 00 = blinking bright green
set tty cursor
tty buffer
file close handle
end with 0
--- Error! ...the program will go here if sample.xyz not found.
set size=16
set mode=1
set tty blink to enable a blinking cursor
set color=8C 00 00 = blinking bright red
tty error
end with 255
eof
╔═════════════════════════════════════════════════════════════════════╗
║ Becoming a registered user ║
╚═════════════════════════════════════════════════════════════════════╝
If you have enjoyed using XYZ, then you are welcome to register it
for $30. This $30 will enable you to use it to compile and register
your own programs for fun or profit. Without this registration
process, any programs you compile with it remain the property of the
owner(s) of the XYZ software application product. See the topic "XYZ
License Agreement" for more information.
Please send your registration fee to:
XYZ
PO BOX #40943
Tempe, AZ 85274
Make check(s) payable to: Andrew Robinson
Soon to be released are:
* A 32-bit version of XYZ
* An XYZ debugger for troubleshooting your compiled programs
* A Windows95 compiler written as an XYZ application
For Corporate registrations, the registration fee will be $300. For
international corporate registrations, the registration fee will be
$1000.
Windows95 is a trademark of Microsoft Corp.
╔═════════════════════════════════════════════════════════════════════╗
║ APPENDIX: ║
╚═════════════════════════════════════════════════════════════════════╝
┌─────────────────────────────────────────────────────────────────────┐
│ Table of Scan Codes for 101/102-Key Keyboard (in hexadecimal): │
└─────────────────────────────────────────────────────────────────────┘
Main keyboard:
┌───┐┌──┬──┬──┬──┐┌──┬──┬──┬──┐┌──┬───┬───┬───┐┌───┬───┬───┐
│Esc││F1│F2│F3│F4││F5│F6│F7│F8││F9│F10│F11│F12││Prt│Scl│Paw│
│ 01││3B│3C│3D│3E││3F│40│41│42││43│ 44│ 57│ 58││ │ 57│ │
└───┘└──┴──┴──┴──┘└──┴──┴──┴──┘└──┴───┴───┴───┘└───┴───┴───┘
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──────┐┌───┬───┬───┐
│` │ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│ 9│ 0│ -│ =│── ││Ins│Hom│PgU│
│29│02│03│04│05│06│07│08│09│0A│0B│0C│0D│ 0E ││*52│*47│*49│
├──┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─────┤├───┼───┼───┤
│Tab│ Q│ W│ E│ R│ T│ Y│ U│ I│ O│ P│ [│ ]│ ││Del│End│PgD│
│ 0F│10│11│12│13│14│15│16│17│18│19│1A│1B│ ││*53│*4F│*51│
├───┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┴┬─┘ │└───┴───┴───┘
│Caps│ A│ S│ D│ F│ G│ H│ J│ K│ L│ ;│ '│ ENTER │
│ 3A │1E│1F│20│21│22│23│24│25│26│27│28│ 1C ─┘│
├────┴─┬┴─┬┴─┬┴─┬┴─┬┴─┬┴─┬┴─┬┴─┬┴─┬┴─┬┴────┬──┤┌───┐
│Shift │ Z│ X│ C│ V│ B│ N│ M│ ,│ .│ /│Shift│\ ││ │
│ 2A │2C│2D│2E│2F│30│31│32│33│34│35│ 36 │2B││*48│
├────┬─┴┬─┴──┼──┴──┴──┴──┴──┴──┴┬─┴──┼───┬─┴──┤┌───┼───┼───┐
│Ctrl│ │Alt │ Space Bar │Alt │ │Ctrl││ │ │ │
│ 1D │ │ 38 │ 39 │*38 │ │*10 ││*4B│*50│*40│
└────┘ └────┴──────────────────┴────┘ └────┘└───┴───┴───┘
Numeric keypad:
┌───┬───┬───┬───┐
│Num│ / │ * │ - │
│ 45│*36│ 37│ 4A│
├───┼───┼───┼───┤
│ 7 │ 8 │ 9 │ │
│ 47│ 48│ 49│ + │
├───┼───┼───┤ 4E│
│ 4 │ 5 │ 6 │ │
│ 4B│ 4C│4D │ │
├───┼───┼───┼───┤
│ 1 │ 2 │ 3 │ │
│ 4F│ 50│ 51│─┘│ Notes:
├───┴───┼───┤*1C│ * = E0
│ Ins │Del│ │ Prt = E0 2A E0 37
│ 52 │ 53│ │ Paw (pause) = E0 10 45
└───────┴───┴───┘ Scan Codes for 84 or 83-Key Keyboards are the same.
┌─────────────────────────────────────────────────────────────────────┐
│ Table of video modes and their default colors: │
└─────────────────────────────────────────────────────────────────────┘
For sixteen color video/text modes:
┌──────────────────┬──────────────────┐
│ Background Hex │Foreground Hex │
│ Color Value│ Color Value │
├──────────────────┼──────────────────┤
│ Black 0 │ Black 0 │
│ Blue 1 │ Blue 1 │
│ Green 2 │ Green 2 │
│ Cyan 3 │ Cyan 3 │
│ Red 4 │ Red 4 │
│ Magenta 5 │ Magenta 5 │
│ Brown 6 │ Brown 6 │
│ White 7 │ White 7 │
│ Black blink 8 │ Dark gray 8 │
│ Blue blink 9 │ Light blue 9 │
│ Green blink A │ Light green A │
│ Cyan blink B │ Light cyan B │
│ Red blink C │ Light red C │
│ Magenta blink D │ Light magenta D │
│ Brown blink E │ Yellow E │
│ White blink F │ Bright white F │
└──────────────────┴──────────────────┘
Some sample colors for the 16.8M color modes:
Black = 00 00 00
Blue = 00 00 FF
Brown = 7F 29 29
Chocolate = D1 69 1E
Cyan = 00 FF FF
Flesh = FF 7D 40
Gold = FF D7 00
Green = 00 64 00
Grey = 6F 6F 6F
Hotpink = FF 6A 64
Indigo = 08 2E 54
Ivory = FF FF F0
Lightgrey = D3 D3 D3
Magenta = FF 00 FF
Maroon = 60 2F 60
Olive = 3B 5E 2B
Orange = FF 80 00
Purple = A0 20 F0
Red = FF 00 00
Skyblue = 87 CE FA
Tan = D2 64 8C
Turquoise = 40 E0 D0
Violet = 8E 5E 99
White = FF FF FF
Yellow = FF FF 00
┌─────────────────────────────────────────────────────────────────────┐
│ Table of ASCII codes: │
└─────────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────┐
│ 0 Nul 32 BL 64 @ 96 ` 128 Ç 160 á 192 └ 224 α │
│ 1 33 ! 65 A 97 a 129 ü 161 í 193 ┴ 225 ß │
│ 2 34 " 66 B 98 b 130 é 162 ó 194 ┬ 226 Γ │
│ 3 35 # 67 C 99 c 131 â 163 ú 195 ├ 227 π │
│ 4 36 $ 68 D 100 d 132 ä 164 ñ 196 ─ 228 Σ │
│ 5 37 % 69 E 101 e 133 à 165 Ñ 197 ┼ 229 σ │
│ 6 38 & 70 F 102 f 134 å 166 ª 198 ╞ 230 µ │
│ 7 39 ' 71 G 103 g 135 ç 167 º 199 ╟ 231 τ │
│ 8 40 ( 72 H 104 h 136 ê 168 ¿ 200 ╚ 232 Φ │
│ 9 TAB 41 ) 73 I 105 i 137 ë 169 ⌐ 201 ╔ 233 Θ │
│ 10 LF 42 * 74 J 106 j 138 è 170 ¬ 202 ╩ 234 Ω │
│ 11 43 + 75 K 107 k 139 ï 171 ½ 203 ╦ 235 δ │
│ 12 FF 44 , 76 L 108 l 140 î 172 ¼ 204 ╠ 236 ∞ │
│ 13 CR 45 - 77 M 109 m 141 ì 173 ¡ 205 ═ 237 φ │
│ 14 46 . 78 N 110 n 142 Ä 174 « 206 ╬ 238 ε │
│ 15 47 / 79 O 111 o 143 Å 175 » 207 ╧ 239 ∩ │
│ 16 48 0 80 P 112 p 144 É 176 ░ 208 ╨ 240 ≡ │
│ 17 49 1 81 Q 113 q 145 æ 177 ▒ 209 ╤ 241 ± │
│ 18 50 2 82 R 114 r 146 Æ 178 ▓ 210 ╥ 242 ≥ │
│ 19 51 3 83 S 115 s 147 ô 179 │ 211 ╙ 243 ≤ │
│ 20 52 4 84 T 116 t 148 ö 180 ┤ 212 ╘ 244 ⌠ │
│ 21 53 5 85 U 117 u 149 ò 181 ╡ 213 ╒ 245 ⌡ │
│ 22 54 6 86 V 118 v 150 û 182 ╢ 214 ╓ 246 ÷ │
│ 23 55 7 87 W 119 w 151 ù 183 ╖ 215 ╫ 247 ≈ │
│ 24 56 8 88 X 120 x 152 ÿ 184 ╕ 216 ╪ 248 ° │
│ 25 57 9 89 Y 121 y 153 Ö 185 ╣ 217 ┘ 249 ∙ │
│ 26 58 : 90 Z 122 z 154 Ü 186 ║ 218 ┌ 250 · │
│ 27 59 ; 91 [ 123 { 155 ¢ 187 ╗ 219 █ 251 √ │
│ 28 60 < 92 \ 124 | 156 £ 188 ╝ 220 ▄ 252 ⁿ │
│ 29 61 = 93 ] 125 } 157 ¥ 189 ╜ 221 ▌ 253 ² │
│ 30 62 > 94 ^ 126 ~ 158 ₧ 190 ╛ 222 ▐ 254 ■ │
│ 31 63 ? 95 _ 127 159 ƒ 191 ┐ 223 ▀ 255 BL│
└───────────────────────────────────────────────────────────────┘
Notes:
All codes are in decimal.
BL = Blank
LF = line feed (goto next line)
FF = form feed (goto next page)
CR = carriage return (goto first char on current line)
TAB = goto next tab stop
┌─────────────────────────────────────────────────────────────────────┐
│ List of some common DOS 21h interrupts: │
└─────────────────────────────────────────────────────────────────────┘
Auxiliary input
Call with: AX=0300h
Returns : AL=ASCII code for character
----------------------------------------------------------------------
Auxiliary output
Call with: AX=0400h
DL=ASCII code for character
----------------------------------------------------------------------
Character input with buffer
Call with: AX=0A00h
DS:DX=segment:offset of buffer
----------------------------------------------------------------------
Character input without buffer (clears buffer)
Call with: AX=0C01h or
AX=0C06h or
AX=0C07h or
AX=0C08h or
AX=0C0Ah
Returns : If AL not=0C0Ah
AL=ASCII code for character
If AL=0C0Ah
DS:DX=segment:offset of input buffer
----------------------------------------------------------------------
Character input with echo
Call with: AX=0100h
Returns : AL=ASCII code for character
----------------------------------------------------------------------
Character input without echo (unfiltered)
Call with: AX=0700h
Returns : AL=ASCII code for character
----------------------------------------------------------------------
Character input without echo
Call with: AX=0800h
Returns : AL=ASCII code for character
----------------------------------------------------------------------
Character output
Call with: AX=0200h
DL=ASCII code for character
----------------------------------------------------------------------
Character string, Output
Call with: AX=0900h
DS:DX=segment:offset of string
----------------------------------------------------------------------
Check input status
Call with: AX=0B00h
Returns : If no character is available AL=00h
If at least one character is available AL=FFh
----------------------------------------------------------------------
Create new Program Segment Prefix (PSP)
Call with: AX=2600h
Returns : DX=Segment of new program segment prefix
----------------------------------------------------------------------
Direct console I/O
Call with: AX=0600h
DX=0000h-00FEh (if output request)
DX=00FFh (if input request)
Returns : If called with DL=00FFh and a character is ready:
Zero flag=clear
AL=ASCII code for character
If called with DL=00FFh and no character is ready
Zero flag=set
----------------------------------------------------------------------
Disk, Get allocation information about
Call with: AX=3600h
DX=Drive code (0000=default, 0001=A,...)
Returns : If drive valid...
AX=Sectors per cluster
BX=Number of available clusters
CX=Bytes per sector
DX=Clusters per drive
If drive invalid AX=FFFFh
----------------------------------------------------------------------
Disk, Get current
Call with: AX=1900h
Returns : AL=Drive code (0=A, 1=B,...)
----------------------------------------------------------------------
Disk, Get data on
Call with: AX=1B00h for default drive
Returns : If invalid drive or critical error AL=FFh
Else AL=Sectors per cluster
DS:BX=segment:offset of media ID byte
CX=Size of physical sector (bytes)
DX=Number of clusters for default drive
----------------------------------------------------------------------
Disk, Read sector from (Interrupt 25h, ignoring logical structure)
Call with: AX=Drive number (0000=A, 0001=B,...)
DX=Starting sector number
If partitions <= 32 megabytes
CX=Number of sectors to read and
DS:BX=segment:offset of buffer
If partitions > 32 megabytes [Version 4.0+]
CX=-1 and
DS:BX=segment:offset of parameter block
Returns : If function successful Carryflag=clear
If function unsuccessful
Carry flag=set
AX=Error code
----------------------------------------------------------------------
Disk, Reset
Call with: AX=0D00h
----------------------------------------------------------------------
Disk, Select
Call with: AH=0Eh
AL=Number of logical drives in system
DX=Drive code (0000=A, 0001=B,...)
----------------------------------------------------------------------
Disk, Write sector to (Interrupt 26h, ignoring logical structure)
Call with: AX=Drive number (0000=A, 0001=B,...)
DX=Starting sector number
If partitions <= 32 megabytes
CX=Number of sectors to write and
DS:BX=segment:offset of buffer
If partitions > 32 megabytes [Version 4.0+]
CX=-1 and
DS:BX=segment:offset of parameter block
Returns : If function successful Carryflag=clear
If function unsuccessful
Carryflag=set
AX=Error code
----------------------------------------------------------------------
Duplicate handle
Call with: AX=4500h
BX=Handle to be duplicated
Returns : If duplicated
Carry flag=clear
AX=New handle
If not
Carry flag=set
AX=04h or 06h Error code
----------------------------------------------------------------------
Execute program
Call with: AX=4B00h to load and execute program
AX=4B03h to load overlay
DS:DX=segment:offset of program specification
Returns : If program executed Carry flag=clear upon return
Note: CS:IP must be preserved
If not
Carry flag=set
AX=01h, 02h, 03h, 05h, 08h, 0Ah, or 0Bh Error codes
----------------------------------------------------------------------
File directory, Create
Call with: AX=3900h
DS:DX=segment:offset of ASCIIZ path name
Returns : If directory created Carry flag=clear
If directory not created
Carry flag=set
AX=0003h or 0005h Error code
----------------------------------------------------------------------
File directory, delete
Call with: AX=3A00h
DS:DX=segment:offset of ASCIIZ path name
Returns : If directory deleted Carry flag=clear
If directory not deleted
Carry flag=set
AX=03h, 05h, or 10h Error code
----------------------------------------------------------------------
File directory, Find first file in
Call with: AX=4E00h
CX=Attribute to use in search
1 =Read-only
2 =Hidden
4 =System
8 =Volume label
10h=Directory
20h=Archive
DS:DX=segment:offset of ASCIIZ path name
Returns : If first file found
Carry flag=clear
Disk transfer area (DTA) will be filled in as follows:
Byte# 00h-14h=0 (Reserved)
Byte# 15h=Attribute of matched file or directory
Byte# 16h-17h=Packed file time
Byte# 18h-19h=Packed file date
Byte# 1Ah-1Dh=File size
Byte# 1Eh-2Ah=ASCIIZ filename
If not
Carry flag=set
AX=02h, 03h, or 12h Error codes
----------------------------------------------------------------------
File directory, Find next file in
Call with: AX=4F00h
Assumes previous call to Int 21 Function 4Eh or 4Fh
Returns : If next file found
Carry flag=clear
DTA filled in
If not
Carry flag=set
AX=12h Error code
Note : Disk transfer area (DTA) will be filled in as follows...
Byte# 00h-14h=0 (Reserved)
Byte# 15h=Attribute of matched file or directory
Byte# 16h-17h=Packed file time
Byte# 18h-19h=Packed file date
Byte# 1Ah-1Dh=File size
Byte# 1Eh-2Ah=ASCIIZ filename
----------------------------------------------------------------------
File directory, Get current
Call with: AX=4700h
DX=Drive code (000=default, 0001=A,...)
DS:SI=segment:offset of 64-byte buffer
Returns : If successful
Carry flag=clear
buffer is filled in with full path name
If not
Carry flag=set
AX=0Fh Error code
----------------------------------------------------------------------
File directory, Set current
Call with: AX=3B00h
DS:DX=segment:offset of ASCIIZ path name
Returns : If successful Carry flag=clear
If unsuccessful
Carry flag=set
AX=3 Error code
----------------------------------------------------------------------
File, Close
Call with: AX=3E00h
BX=Handle
Returns : If file closed Carry flag=clear
If file still open
Carry flay=set
AX=06h Error code
----------------------------------------------------------------------
File, Commit (forces buffer to be written out)
Call with: AX=6800h
BX=Handle
Returns : If file commited Carry flag=clear
If not
Carry flag=set
AX=Error code
----------------------------------------------------------------------
File, Create
Call with: AX=3C00h
CX=File attribute...
1 =Read-only
2 =Hidden
4 =System
8 =Volume label
20h=Archive
DS:DX=segment:offset of ASCIIZ path name
Returns : If file created
Carry flag=clear
AX=Handle
If file not created
Carry flag=set
AX=3, 4, or 5 Error code
----------------------------------------------------------------------
File, Create temporary
Call with: AX=5A00h
CX=Attribute
1 =Read-only
2 =Hidden
4 =System
8 =Volume label
20h=Archive
DS:DX=segment:offset of ASCIIZ path name
Returns : If file created
Carry flag=clear
AX=Handle
DS:DX=segment:offset of complete ASCIIZ path name
If not
AX=03h, 04h, or 05h Error codes
----------------------------------------------------------------------
File, Create new
Call with: AX=5B00h
CX=Attribute
1 =Read-only
2 =Hidden
4 =System
8 =Volume label
20h=Archive
DS:DX=segment:offset of ASCIIZ path name
Returns : If file created
Carry flag=clear
AX=Handle
DS:DX=segment:offset of complete ASCIIZ path name
If not
AX=03h, 04h, 05h, or 50h Error codes
----------------------------------------------------------------------
File, Delete
Call with: AX=4100h
DS:DX=segment:offset of ASCIIZ path name
Returns : If deleted Carry flag=clear
If not deleted
Carry flag=set
AX=02h, 03h, or 05h Error code
----------------------------------------------------------------------
File, Extended open, create, or replace File for DOS Version 4.0+
Call with: AH=6C00h
BX=Open mode
Access type...
0=read-only
1=write-only
2=read/write
Sharing mode...
0 =compatibility
10h=deny read/write
20h=deny write
30h=deny read
40h=deny none
Inheritance...
0 =child process inherits handle
80h=child does not inherit handle
Critical error handling...
0 =execute Int 24h
2000h=return error to process
Write-through...
0 =writes may be buffered and deferred
4000h=physical write at request time
CX=File attribute
1 =read-only
2 =hidden
4 =system
8 =volume label
20h=archive
DX=Open flag
Action if file exists...
0=fail
1=open file
2=replace file
Action if file doesn't exist...
0=fail
80h=create file
DS:SI=segment:offset of ASCIIZ path name
Returns : If function successful
Carry flag=clear
AX=Handle
CX=Action taken
1=File existed and was opened
2=File did not exist and was created
If function unsuccessful
Carry flag=set
AX=Error code
----------------------------------------------------------------------
File, Get or set attributes of
Call with: AX=4300h if getting file attribute
AX=4301h if setting file attribute
CX=New file attribute if AL=01h
1 =Read-only
2 =Hidden
4 =System
20h=Archive
DS:DX=segment:offset of ASCIIZ path name
Returns : If file attribute set
Carry flag=clear
CX=File attribute
If file attribute not set
Carry flag=set
AX=01h, 02h, 03h, or 05h Error code
----------------------------------------------------------------------
File, Get or set date and time of
Call with: If getting date and time
AX=5700h
BX=Handle
If setting date and time
AX=5701h
BX=Handle
CX=Time
Bits 0Bh-0Fh=hours (0-23)
Bits 05h-0AH=minutes (0-59)
Bits 00h-04h=2-second increments (0-29)
DX=Date
Bits 09h-0Fh=year (relative to 1980)
Bits 05h-08h=month (1-12)
Bits 00h-04h=day (1-31)
Returns : If date and time set or got
Carry flag=clear
CX=Time
DX=Date
If not
Carry flag=set
AX=01h or 06h Error codes
----------------------------------------------------------------------
File, Lock or unlock region of
Call with: AX=5C00h if locking region
AX=5C01h if unlocking region
BX=Handle
CX=High part of region offset
DX=Low part of region offset
SI=High part of region length
DI=Low part of region length
Returns : If file created
Carry flag=clear
If not
Carry flag=set
AX=01h, 06h, 21h, or 24h Error codes
----------------------------------------------------------------------
File, Open
Call with: AH=3Dh
AL=Access mode...
0=read access
1=write access
2=read/write access
Sharing mode...
0 =compatibility mode
10h=deny all
20h=deny write
30h=deny read
40h=deny none
Inheritance flag...
0 =Child process inherits handle
80h=Child does not inherit handle
DS:DX=segment:offset of ASCIIZ path name
Returns : If file opened
Carry flag=clear
AX=Handle
If file unopened
Carry flag=set
AX=2, 3, 4, 5, or 0Ch Error code
----------------------------------------------------------------------
File, Rename
Call with: AX=5600h
DS:DX=segment:offset of current ASCIIZ path name
ES:DI=segment:offset of new ASCIIZ path name
Returns : If file renamed Carry flag=clear
If not
Carry flag=set
AX=02h, 03h, 05h, or 11h Error codes
----------------------------------------------------------------------
File, Set handle count (sets maximum number of files)
Call with: AX=6700h
BX=Number of desired handles
Returns : If handle count set Carry flag=clear
If not
Carry flag=set
AX=Error code
----------------------------------------------------------------------
File, Set location of pointer in
Call with: AX=4200h Absolute offset from start of file
AX=4201h Signed offset from current file pointer
AX=4202h Signed offset from end of file
BX=Handle
CX=Most significant half of offset to move
DX=Least significant half of offset to move
Returns : If file pointer set
Carry flag=clear
AX=Least significant half of resulting file pointer
DX=Most significant half of resulting file pointer
If file pointer not set
Carry flag=set
AX=01h or 06h Error code
----------------------------------------------------------------------
File or device, Read from
Call with: AX=3F00h
BX=Handle
CX=Number of bytes to read
DS:DX=segment:offset of buffer
Returns : If read
Carry flag=clear
AX=Number of bytes read
If not read
Carry flag=set
AX=05h or 06h Error code
----------------------------------------------------------------------
File or device, Write to
Call with: AX=4000h
BX=Handle
CX=Number of bytes to write
DS:DX=segment:offset of buffer
Returns : If written
Carry flag=clear
AX=Number of bytes written
If not written
Carry flag=set
AX=05h or 06h Error code
----------------------------------------------------------------------
Get Data Transfer Area (DTA) address
Call with: AX=2F00h
Returns : ES:BX=segment:offset of DTA
----------------------------------------------------------------------
Get Date
Call with: AX=2A00h
Returns : CX=Year (1980 through 2099)
DH=Month (1 through 12)
DL=Day (1 through 31)
AL=Day of the week (0=Sunday, 1=Monday,...)
----------------------------------------------------------------------
Get Extended Country Information
Call with: AX=6502h to get pointer to Uppercase Table
AX=6504h to get pointer to Filename Uppercase Table
AX=6506h to get pointer to Collating Table
AX=6507h to get pointer to DBCS Vector [Version 4.0+]
BX=Code page of interest (-1=active CON device)
CX=Length of buffer to receive information
DX=Country ID (-1=default)
ES:DI=Address of buffer to receive information
Returns : If file created
Carry flag=clear
If not
Carry flag=set
AX=02h Error code
----------------------------------------------------------------------
Get Extended Error Information
Call with: AH=59h
BX=00h
Returns : AX=Extended error code
BH=Error class...
01h Out of storage or handles
02h Temporary error (such as locked region in
file) that can be expected to end)
03h Authorization problem
04h Internal error in system software
05h Hardware failure
06h System software failure (such as missing
configuration files)
07h Application program error
08h File or item not found
09h File or item of invalid type or format
0Ah File or item locked
0Bh Wrong disk in drive, bad spot on disk, or
storage medium problem
0Ch Unknown error
BL=Recommended action...
01h Retry reasonable number of times, then prompt
user to select abort or ignore
02h Retry reasonable number of times with delay
between retries, then prompt user to select
abort or ignore
03h Get corrected information from user caused by
incorrect filename or drive specification
04h Abort application and by terminating the
program, releasing locks, closing files,...
05h Abort application.
06h Ignore error
07h Retry after user intervention to remove cause
of error
CH=Error locus...
01h Unknown
02h Block device
03h Network
04h Serial device
05h Memory
ES:DI=ASCIIZ volume label of disk to insert, if
AX=0022h (invalid disk change)
----------------------------------------------------------------------
Get Interrupt Vector
Call with: AX=3500h
AL=Interrupt number
Returns : ES:BX=segment:offset of interrupt handler
----------------------------------------------------------------------
Get DOS Version Number
Call with: AX=3000h
Returns : AL=Major version number
AH=Minor version number
----------------------------------------------------------------------
Get Program Segment Prefix (PSP) Address
Call with: AX=6200h
Returns : BX=Segment address of PSP
----------------------------------------------------------------------
Get Return Code
Call with: AX=4D00h
Returns : AH=00h if normal termination by Int 20h, Int 21h
Function 0, or Int 21h Function 4Ch
AH=02h if termination by critical-error handler
AH=03h if termination by Int 21h Function 31h or
Int 27h
AL=Return code passed by child process...0 if child
terminated by Int 20h, Int 21h Function 00h, or
Int 27h
----------------------------------------------------------------------
Get Time
Call with: AX=2C00h
Returns : CH=Hour (0 through 23)
CL=Minute (0 through 59)
DH=Second (0 through 59)
DL=Hundredths of a second (0 through 99)
----------------------------------------------------------------------
Get Verify Flag
Call with: AX=5400h
Returns : AL=00h if verify OFF
AL=01h if verify ON
----------------------------------------------------------------------
Get address of InDOS Flag
Call with: AX=3400h
Returns : ES:BX=Address of InDos flag
----------------------------------------------------------------------
Get or Set Allocation Strategy
Call with: If getting strategy code
AX=5800h
If setting strategy code
AX=5801h
BX=00h for First fit
BX=01h for Best fit
BX=02h for Last fit
Returns : If allocation strategy set or got
Carry flag=clear
AX=00h for First fit
AX=01h for Best fit
AX=02h for Last fit
If not
Carry flag=set
AX=01h Error code
----------------------------------------------------------------------
Get or Set Break Flag
Call with: AX=3300h if getting Break flag status
AX=3301h if setting Break flag status
Returns : If the Break flag is off DL=00h
If the Break flag is on DL=01h
If setting Break flag returns nothing
----------------------------------------------------------------------
Get or Set Code Page
Call with: AX=6601h to get code page
AX=6602h to select code page
If AX=6602h
BX=Code page to select
Returns : If code page set or got
Carry flag=clear
If also called with AL=01h
BX=Active code page
DX=Default code page
If not
Carry flag=set
AX=02h or 65h Error codes
----------------------------------------------------------------------
Get or Set Country Information
Call with: If getting internationalization information...
To get current country information
AX=3800h
To get information if country code < 255
AX=3801-38FEh
To get information if country code >= 255
AX=38FFh
BX=Country code if AL=FFh
DS:DX=segment:offset of buffer for returned info
If setting current country code...
AX=3801-38FEh if country code < 255
AX=38FFh if country code >= 255
BX=Country code if AX=38FFh
DX=FFFFh
Returns : If getting internationalization information...
If call successful
Carry flag=clear
BX=Country code
The buffer is filled in as follows:
Byte# 00h-01h=Date format...
Bit 0=USA month/day/year
Bit 1=Europe day/month/year
Bit 2=Japan year/month/day
Byte# 02h-06h=ASCIIZ currency symbol
Byte# 07h-08h=ASCIIZ thousands separator
Byte# 09h-0Ah=ASCIIZ decimal separator
Byte# 0Bh-0Ch=ASCIIZ date separator
Byte# 0Dh-0Eh=ASCIIZ time separator
Byte# 0Fh Currency format...
Bit 0=0 if currency value follows symbol
Bit 0=1 if currency symbol follows value
Bit 1=0 if no space between value and
currency symbol
Bit 1=1 if one space between value and
currency symbol
Bit 2=0 if currency symbol and decimal
are seperate
Bit 2=1 if currency symbol replaces
decimal seperator
Byte# 10h=Number of digits after decimal in
currency
Byte# 11h=Time format...
Bit 0=0 if 12-hour time
Bit 0=1 if 24-hour time
Byte# 12h-15h=Case-map call address
Byte# 16h-17h=ASCIIZ data-list separator
Byte# 18h-21h=Reserved
If call unsuccessful
Carry flag is set
AX=0002h Error code
----------------------------------------------------------------------
IOCTL (I/2609ntrol):
*Get Device Information
AX=4400h
BX=Handle
If function successful Carry flag: clear
DX=Device information word for a file...
Bits 0-5 =drive number (0=A, 1=B,...)
Bit 6 =0 (file has been written)
=1 (file has not been written)
Bit 7 =0 (indicating a file)
Bits 8-15=0 (reserved)
Device information for a device...
Bit 0 =1 (if console input)
Bit 1 =1 (if console output)
Bit 2 =1 (if NUL device)
Bit 3 =1 (if clock device)
Bit 4 =reserved
Bit 5 =0 (if handle in ASCII mode)
=1 (if handle in binary mode)
Bit 6 =0 (if end of file on input)
Bit 7 =1 (indicating a device)
Bits 8-13=reserved
Bit 14 =1 (if device supports IOCTL Read
and Write Control Data subfunctions)
=0 (if Control Data subfunctions not
supported)
Bit 15 =reserved
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, or 06h)
*Change Sharing Retry Count
Call with: AX=440Bh
CX=Delays per retry (default=1)
DX=Number of retries (default=3)
Returns : If function successful
Carry flag: clear
If function unsuccessful
Carry flag: set
AX=Error code (01h)
*Check Input Status
Call with: AX=4406h
BX=Handle
Returns : If function successful
Carry flag: clear
And for a device
AL=00h (if device not ready)
=FFh (if device ready)
Or for a file
AL=00h (if file pointer at EOF)
=FFh (if file pointer not at EOF)
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, 06h,or 0Dh)
*Check Output Status
Call with: AX=4407h
BX=Handle
Returns : If function successful
Carry flag: clear
And for a device
AL=00h (if device not ready)
=FFh (if device ready)
Or for a file
AL=FFh
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, 06h,or 0Dh)
*Check if Block Device is Remote
Call with: AX=4409h
BX=Drive number (0=default, 1=A, 2=B,...)
Returns : If function successful
Carry flag: clear
DX=Device attribute word
Bit 12=0 (if drive is local)
=1 (if drive is remote)
If function unsuccessful
Carry flag: set
AX=Error code (01h or 0Fh)
*Check if Block Device is Removable
Call with: AX=4408h
BX=Drive number (0=default, 1=A, 2=B,...)
Returns : If function successful
Carry flag: clear
AL=00h (if medium is removable)
=01h (if medium is not removable)
If function unsuccessful
Carry flag: set
AX=Error code (01h or 0Fh)
*Check if Handle is Remote
Call with: AX=440Ah
BX=Handle
Returns : If function successful
Carry flag: clear
DX=Attribute word for file or device
Bit 15=0 (if local)
=1 (if remote)
If function unsuccessful
Carry flag: set
AX=Error code (01h or 06h)
*Generic I/O Control for Block Devices
Call with: AX=440Dh
BX=Drive code (0=default, 1=A, 2=B,...)
CX=Minor function code...
0840h=Set Device Parameters
0841h=Write Track
0842h=Format and Verify Track
0846h=Set Media ID (4.0+)
0847h=Set Access Flag
0860h=Get Device Parameters
0861h=Read Track
0862h=Verify Track
0866h=Get Media ID (4.0+)
0867h=Get Access Flag
DS:DX=segment:offset of parameter block
Returns : If function successful...
Carry flag: clear
...and if called with CL=60h or 61h
DS:DX=segment:offset of parameter block
If function unsuccessful
Carry flag: set
AX=Error code (01h or 02h)
*Generic I/O Control for Character Devices
Call with: AX=440Ch
BX=Handle
CH=Category (major) code:
00=Unknown
01=COM1, COM2, COM3, or COM4
03=CON (keyboard and display)
05=LPT1, LPT2, or LPT3
CL=Function (minor) code:
45h=Set Iteration Count
4AH=Select Code Page
4CH=Start Code Page Preparation
4DH=End Code Page Preparation
5Fh=Set Display Information [Version 4.0]
65h=Get Iteration Count
6AH=Query Selected Code Page
6BH=Query Prepare List
7Fh=Get Display Information [Version 4.0]
DS:DX=segment:offset of parameter block
Returns : If function successful
Carry flag: clear
And if called with CL=65h, 6Ah, or 6Bh
DS:DX=segment:offset of parameter block
If function unsuccessful
Carry flag: set
AX=Error code (01h)
*Get Logical Drive Map
Call with: AX=440Eh
BX=Drive code (0=default, 1=A, 2=B,...)
Returns : If function successful
Carry flag: clear
AL=Mapping code
=00h (if only one logical drive code assigned to
the block device) ...)
=01h-1Ah (logical drive code (1=A, 2=B,...)
mapped to the block device)
If function unsuccessful
Carry flag: set
AX=Error code (01h or 05h)
*Read Control Data from Block Device Driver
Call with: AX=4404h
BX=Drive code (0=default, 1=A, 2=B,...)
CX=Number of bytes to read
DS:DX=segment:offset of buffer
Returns : If function successful
Carry flag: clear
AX=Bytes transferred
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, 06h,or 0Dh)
*Read Control Data from Character Device Driver
Call with: AX=4402h
BX=Handle
CX=Number of bytes to read
DS:DX=segment:offset of buffer
Returns : If function successful
Carry flag: clear
AX=Bytes read and
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, 06h, or 0Dh)
*Set Device Information
AX=4401h
BX=Handle
DX=Device information word
Bit 0 =1 (if console input)
Bit 1 =1 (if console output)
Bit 2 =1 (if NUL device)
Bit 3 =1 (if clock device)
Bit 4 =0 (reserved)
Bit 5 =0 (to select ASCII mode)
=1 (to select binary mode)
Bit 6 =0 (reserved)
Bit 7 =1 (indicating a device)
Bits 8-15=0 (reserved)
Returns: If function successful Carry flag: clear
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, or 06h)
*Set Logical Drive Map
Call with: AX=440Fh
BX=Drive code (0=default, 1=A, 2=B,...)
Returns : If function successful
Carry flag: clear
AL=Mapping code
=00h (if only one logical drive code assigned
to the block device)
=01h-1Ah (logical drive code (1=A, 2=B,...)
mapped to the block device)
If function unsuccessful
Carry flag: set
AX=Error code (01h or 05h)
*Write Control Data to Block Device Driver
Call with: AX=4405h
BX=Drive code (0=default, 1=A, 2=B,...)
CX=Number of bytes to write
DS:DX=segment:offset of data
Returns : If function successful
Carry flag: clear
AX=Bytes transferred
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, 06h,or 0Dh)
*Write Control Data to Character Device Driver
Call with: AX=4403h
BX=Handle
CX=Number of bytes to write
DS:DX=segment:offset of data
Returns : If function successful
Carry flag: clear
AX=Bytes transferred
If function unsuccessful
Carry flag: set
AX=Error code (01h, 05h, 06h, or 0Dh)
----------------------------------------------------------------------
Memory, Allocate block
Call with: AX=4800h
BX=Number of paragraphs of memory needed
Returns : If memory allocated
Carry flag=clear
AX=Initial segment of allocated block
If not
Carry flag=set
AX=07h or 08h Error code
BX=Size of largest available block (paragraphs)
----------------------------------------------------------------------
Memory, Release block
Call with: AX=4900h
ES=Segment of block to be released
Returns : If memory released Carry flag=clear
If not
Carry flag=set
AX=07h or 09h Error code
----------------------------------------------------------------------
Memory, Resize block
Call with: AX=4A00h
BX=Desired new block size in paragraphs
ES=Segment of block to be modified
Returns : If memory resized Carry flag=clear
If not
AX =07, 08h, or 09h Error code
BX=Maximum block size available (paragraphs)
----------------------------------------------------------------------
Multiplex (Interrupt 2Fh)
Call with: AH=01h Print Spooler
AH=06h Resident ASSIGN command
AH=10h Resident SHARE command
AH=B7h Resident APPEND command
AL=Function number
Returns : If on input AL was equal to 0, AL will equal 0FFh upon
return. Otherwise it will depend on the handler
----------------------------------------------------------------------
Printer Output
Call with: AX=0500h
DL=ASCII code for character
----------------------------------------------------------------------
Redirect Handle
Call with: AX=4600h
BX=Handle for file or device
CX=Handle to be redirected
Returns : If handle redirected Carry flag=clear
If not AX=04h or 06h Error code
----------------------------------------------------------------------
Set Data Transfer Area (DTA) Address
Call with: AX=1A00h
DS:DX=segment:offset of disk transfer area
----------------------------------------------------------------------
Set Date
Call with: AX=2B00h
CX=Year (1980 through 2099)
DH=Month (1 through 12)
DL=Day (1 through 31)
Returns : If the date was set AL=00h
If the date was not set AL=FFh
----------------------------------------------------------------------
Set Extended Error Information
Call with: Assumes previous call to function 5900h
AX=5D0Ah
DS:DX=segment:offset of structure
----------------------------------------------------------------------
Set Interrupt Vector
Call with: AH=25h
AL=Interrupt number
DS:DX=segment:offset of interrupt handling routine
----------------------------------------------------------------------
Set Program Segment Prefix (PSP) Address
Call with: AX=5000h
BX=New PSP segment address
----------------------------------------------------------------------
Set Time
Call with: AX=2D00h
CH=Hour (0 through 23)
CL=Minute (0 through 59)
DH=Second (0 through 59)
DL=Hundredths of a second (0 through 99)
Returns : If the time was set AL=00h
If the time was not set AL=FFh
----------------------------------------------------------------------
Set Verify Flag
Call with: AH=2E00h
----------------------------------------------------------------------
Terminate Program:
Call with: AX=0000h
CS=Segment address of program segment prefix
----------------------------------------------------------------------
Terminate Program with Return Code
Call with: AH=4Ch
AL=Return code
----------------------------------------------------------------------
Terminate and Stay Resident
Call with: AH=31h
AL=Return code (0 through 255)
DX=Number of paragraphs to reserve in memory
╔═════════════════════════════════════════════════════════════════════╗
║ List of DOS Extended Error Codes ║
╚═════════════════════════════════════════════════════════════════════╝
Value... Meaning...
01h Function number invalid
02h File not found
03h Path not found
04h Too many open files
05h Access denied
06h Handle invalid
07h Memory control blocks destroyed
08h Insufficient memory
09h Memory block address invalid
0Ah Environment invalid
0Bh Format invalid
0Ch Access code invalid
0Dh Data invalid
0Eh Unknown unit
0Fh Disk drive invalid
10h Attempted to remove current directory
11h Not same device
12h No more files
13h Disk write-protected
14h Unknown unit
15h Drive not ready
16h Unknown command
17h Data error (CRC)
18h Bad request structure length
19h Seek error
1Ah Unknown media type
1Bh Sector not found
1Ch Printer out of paper
1Dh Write fault
1Eh Read fault
1Fh General failure
20h Sharing violation
21h Lock violation
22h Disk change invalid
23h FCB unavailable
24h Sharing buffer exceeded
25h Code page mismatched
26h end of file operation not completed
27h Disk full
28h-31h Reserved
32h Unsupported network request
33h Remote machine not listening
34h Duplicate name on network
35h Network name not found
36h Network busy
37h Device no longer exists on network
38h Network command limit exceeded
39h Error in network adapter hardware
3Ah Incorrect response from network
3Bh Unexpected network error
3Ch Remote adapter incompatible
3Dh Print queue full
3Eh Not enough room for print file
3Fh Print file was deleted
40h Network name deleted
41h Network access denied
42h Incorrect network device type
43h Network name not found
44h Network name limit exceeded
45h Network session limit exceeded
46h Temporary pause
47h Network requested not accepted
48h Print or disk redirection paused
49h-4Fh Reserved
50h File already exists
51h Duplicate FCB
52h Cannot make directory
53h Fail on Int 24H (critical error)
54h Too many redirections
55h Duplicate redirection
56h Invalid password
57h Invalid parameter
58h Network write error
59h Function not supported by network
5Ah Required system component not installed
65h Device not selected
╔═════════════════════════════════════════════════════════════════════╗
║ Using the XYZ Critical Error Handler ║
╚═════════════════════════════════════════════════════════════════════╝
If you were to try and copy a file from your hard disk to a floppy,
and there was no floppy disk in the drive bay, the copy program could
not continue because it cannot copy a file to an empty drive. This
would be an example of a critical error. Other examples would be:
Attempting to write a file to a write-protected disk,
A disk sector is unreadable,
Attempting to read or write to an unformatted disk,
The printer is out of paper, and so on.
Anything listed in the section titled "List of DOS extended error
codes" would also be a good example. Anyways, the program would
have to stop the current task until something is done to enable the
task to be continued. Usually, DOS will print out the infamous
"Abort, Retry, or Fail?" to the current cursor location on the
screen. If you have already gone to great lengths to draw pretty
screen graphics, then DOS will write "Abort, Retry, or Fail?" right
in the middle of all of it! Wouldn't it be better if you could
intercept DOS's improper attempt at correcting a critical error and
replace it with one of your own? You can, with the XYZ critical
error handler! But how does it work?
To enable the XYZ Critical Error Handler, all you need to do is
include one label in your coding. That label should be called
"CriticalError". Somewhere underneath that label, you must include a
"ret" command, since DOS is in an unstable state after responding to
a critical error and is waiting for a response from you as to what to
do.
When a critical error occurs, the reserved argument "error" will
contain one of the error codes listed in the section titled "List of
DOS extended error codes". This code will give you an idea of what
happened and how you might possibly respond to it. There are two
things to remember when responding to a critical error. One is to
inform the user of the error and how to possibly correct the
situation, i.e. -- "There is no disk in drive A:, please insert the
disk now. Press 'Enter' when you are ready." Two, you must use the
command "set error=" to inform the system of your decision of how to
handle the critical error. If error is set to...
0...then the system will act like no error occurred and return
control to the program
1...then the system will keep retrying
2...then the system will terminate the program
3...then the system will act like error occurred but return
control to program anyways.
If you respond with an incorrect decision (i.e. -- the program
cannot continue if the error is not corrected or if the error cannot
be corrected as in a divide by zero or dos internal error), then the
critical error will keep returning to your critical error handler
until the situation is resolved or you terminate the program by
setting error=2.
For example:
000 Example of Critical Error Handling
dat txt 15 filename=a:\xyz.zip
dat txt ErrorMessage=I can't read from drive a...
set color=0A 00 00
set start=1
set size=28
set mode=0
file open filename
jer Quit
tty filename
--- Quit
file close handle
end with 1
--- CriticalError
set color=0C 00 00
set error=3 Informs system to act like an error occured
tty ErrorMessage
ret
eof
Now if the disk is not present when this program tries to open the
file on drive a, then the program will automatically jump to the
"CriticalError" section and display the message "I can't read from
drive a..." before quitting. Otherwise this program will display
"a:\xyz.zip" and quit.